Linux 磁盘管理--RAID1创建
1. 场景
2. POC环境
# uname -a
Linux localhost 3.10.0-123.el7.x86_64 #1SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
3. 具体操作
3.1. 分区
# fdisk -l
Disk /dev/sdc: 32.2 GB, 32212254720 bytes,62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk /dev/sdd: 32.2 GB, 32212254720 bytes,62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
.........
# fdisk /dev/sdc
..........
Command (m for help): p
Disk /dev/sdc: 32.2 GB, 32212254720 bytes,62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk label type: dos
Disk identifier: 0x3dbf19dc
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-62914559, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G}(2048-62914559, default 62914559):
Using default value 62914559
Partition 1 of type Linux and of size 30GiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): fd
Changed type of partition 'Linux' to 'Linuxraid autodetect'
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# fdisk -l/dev/sdc
Disk /dev/sdc: 32.2 GB, 32212254720 bytes, 62914560sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk label type: dos
Disk identifier: 0x3dbf19dc
Device Boot Start End Blocks Id System
/dev/sdc1 2048 62914559 31456256 fd Linux raid autodetect
对/dev/sdd进行同样的分区操作
# fdisk -l/dev/sdd
Disk /dev/sdd: 32.2 GB, 32212254720 bytes,62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes /512 bytes
I/O size (minimum/optimal): 512 bytes / 512bytes
Disk label type: dos
Disk identifier: 0x2b1e2fef
Device Boot Start End Blocks Id System
/dev/sdd1 2048 62914559 31456256 fd Linux raid autodetect
3.2. 创建RAID1
# mount /dev/cdrom /mnt/cdrom
mount: /dev/sr0 is write-protected,mounting read-only
# cd/mnt/cdrom/Packages
# ls md*
mdadm-3.2.6-31.el7.x86_64.rpm
# rpm -Uvhmdadm-3.2.6-31.el7.x86_64.rpm
error: Failed dependencies:
libreport-filesystem is needed by mdadm-3.2.6-31.el7.x86_64
#rpm -Uvh mdadm-3.2.6-31.el7.x86_64.rpmlibreport-filesystem-2.1.11-10.el7.centos.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:libreport-filesystem-2.1.11-10.el################################# [50%]
2:mdadm-3.2.6-31.el7 ################################# [100%]
# mdadm -c/dev/md0 -l 1 -n 2 /dev/sd[cd]1
mdadm: -c does not set the mode, and socannot be the first option.
[root@localhost Packages]# mdadm --create/dev/md0 -l 1 -n 2 /dev/sd[cd]1
mdadm: Note: this array has metadata at thestart and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? yes
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
3.3. 创建文件系统
格式化磁盘阵列
# mkfs.ext4/dev/md0
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7859936 blocks
392996 blocks (5.00%) reserved for thesuper user
First data block=0
Maximum filesystem blocks=2155872256
240 block groups
32768 blocks per group, 32768 fragments pergroup
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystemaccounting information: done
#mkdir /data
# mount /dev/md0 /data
# ll /data
total 16
drwx------ 2 root root 16384 Aug 15 03:01lost+found
设置开机自动挂载
# vi /etc/fstab
在最后添加一行
/dev/md0 /data ext4 defaults 0 0
# mdadm -Ds
ARRAY/dev/md0 metadata=1.2 name=localhost:0 UUID=e236da40:5469327f:1683de23:2d391d6f
写入到配置文件
# mdadm -Ds>> /etc/mdadm.conf
重启验证
#reboot
# mount
/dev/md0 on /data type ext4(rw,relatime,data=ordered)
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdd1[1] sdc1[0]
31439744 blocks super 1.2 [2/2] [UU]
unused devices: <none>
4. 模拟故障
将30GA.vmdk删除
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[1]
31439744 blocks super 1.2 [2/1] [_U]
unused devices: <none>
5. 重建RAID1
模拟恢复,还是30GB的硬盘,添加新的磁盘文件将30GC.VMDK
# fdisk -l
# mdadm /dev/md0 -a /dev/sdc1
mdadm: added /dev/sdc1
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdc1[2] sdd1[1]
31439744 blocks super1.2 [2/1] [_U]
[==>..................] recovery = 11.3% (3554240/31439744) finish=2.2min speed=209072K/sec
unused devices: <none>
查看日志
md: bind<sdc1>
md: recovery of RAID array md0
md: minimum _guaranteed_ speed: 1000 KB/sec/disk.
md: using maximum available idle IO bandwidth (but not more than200000 KB/sec) for recovery.
md: using 128k window, over a total of 31439744k.
转载于:https://blog.51cto.com/wanyi/1540175
Linux 磁盘管理--RAID1创建相关推荐
- linux 磁盘管理 阵列,Linux 磁盘管理~~~~RAID1
Linux磁盘管理~~~~RAID1 实验环境 Linux操作系统的pc机上添加2块30g大小的磁盘 实施步骤: 1.0 对磁盘进行分区 [root@host129~]# fdisk /dev/sdb ...
- linux磁盘管理命令 lv,Linux磁盘管理--LVM原理及基本操作
LVM(Logical Volume Manager)逻辑卷管理是Linux磁盘管理中的常用操作, 本文主要描述LVM的基本原理以及对LVM的扩展和缩减的基本操作. LVM实质是过软件方式将多个物理分 ...
- linux磁盘管理系列一:磁盘配额管理
磁盘管理系列 linux磁盘管理系列一:磁盘配额管理 http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_040_quota.html l ...
- 磁盘管理 ——RAID1+0卷+LVM
磁盘管理 --RAID1+0卷+LVM 准备工作 以两块磁盘为例sdb和sdc,每块硬盘分别建立三个主分区 sdb1 1G, sdb2 1G, s ...
- linux 磁盘管理上(分区操作,格式化文件,挂载和卸载)
一:检测并确认新磁盘,规划磁盘分区 首先加硬盘进去,fdisk -l 查看磁盘分区 device 分区的设备文件名称 boot 是否是引导分区.是 则有*表示 start ...
- linux 磁盘管理3板斧,Linux 磁盘管理的命令
Linux 磁盘管理 磁盘分区及挂载: 先查询系统的使用情况: 使用fdisk -l语句 查询结果: 进行磁盘的新建:***添加磁盘时系统必须处于关机状态** 在进行对系统磁盘的使用情况的查询 查 ...
- linux命令管理GPT分区,Linux磁盘管理GPT分区教程
Linux内核代码量大.逻辑关系复杂,因此对内核中的错误进行追溯和调试一直以来都是一件既耗费时间又耗费精力的事情.接下来是小编为大家收集的 Linux磁盘管理GPT分区教程,希望能帮到大家. Linu ...
- Linux磁盘管理——df、du、磁盘分区、格式化、挂载、LVM
2019独角兽企业重金招聘Python工程师标准>>> Linux磁盘管理 一. df命令 df命令参数功能:检查文件系统的磁盘空间占用情况.可以利用该命令来获取硬盘被占用了多少空间 ...
- Linux用户管理(六)Linux磁盘管理
Linux磁盘管理 一.硬盘分区 1.外部存储器的表示方法 (1)硬盘 l IDE /dev/hdxy l SCSI/USB /dev/sdxy (2)软盘(/dev/fdx) ( ...
最新文章
- linux C高手成长过程---书籍推荐
- React总结篇之十_动画
- 用字节流查看txt文件
- poj1251 Jungle Roads Kruskal算法+并查集
- 出现了!豆瓣最高9.9分,2020年最值得看的美剧!你居然还没看过?【内附资源】...
- 访问linux服务主机,如何把Linux配置为日志服务主机。
- css圆在中心根据宽度缩放_根据CSS中的容器宽度重新缩放字体
- [转]VI/VIM的键盘图
- 令人失望的vb 的范型
- war包的打包与解压
- cloudMusic.mps的前世今坑
- APP响应时间和响应速度测试
- 两个月的一些工作总结
- 小区人脸识别门禁系统解决方案
- 一种圆面积公式的推导方法
- C++/openCV修改视频分辨率
- 产品可靠性研究不可不知的知识之MTTF
- 结构化查询语句简称mysql_整理MySql常用查询语句
- 【计算机基础】03-Word知识
- Day 01嵌入式学习之Linux基础知识和命令操作
热门文章
- Vue2.0+ElementUI+PageHelper实现的表格分页
- MDT2012部署问题,USMT5.0 迁移哪些内容
- java 名词解释等
- 灰鸽子门徒自曝抓肉鸡内幕
- HashSet 和 TreeSet 及 Map 集合的简单方法,含程序。
- python 碎片图像拼接_python实现图像拼接
- laravel手动误删了迁移文件,重新生成
- Adobe Edge Animate --异步条件加载框架(yepnop):加载bootstrap之按钮、进度条、菜单效果
- Dubbo的SPI机制对比传统的SPI做了哪些改进?Dubbo的IOC和AOP
- java语言发展历程