Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0000f635
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 125829119 61864960 8e Linux LVM
Disk /dev/mapper/cl-root: 38.3 GB, 38323355648 bytes, 74850304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/cl-swap: 6308 MB, 6308233216 bytes, 12320768 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/cl-home: 18.7 GB, 18710790144 bytes, 36544512 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdc: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdd: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
磁盘准备好后,我们准备配置磁盘阵列,因为linux下配置磁盘阵列需要使用mdadm命令,所以我们需要安装
我们首先安装mdadm工具yum install -y mdadm
接着我们介绍一下命令---mdadm参数
-a 检测设备名称
-n 指定设备数量
-l 指定RAID等级
-C 创建
-v 显示过程
-f 模拟设备损坏
-r 移除设备
-a 增加设备
-Q 查看摘要信息
-D 查看详细信息
-S 停止
我们使用mdadm命令创建RAID10名称为:dev/md0:
C代表创建操作,-v显示创建过程,-a yes检查RAID没名称,-n是用到硬盘个数,-i定义RAID的级别而后面写上要增加整列的硬盘名称mdadm -Cv /dev/md0 -a yes -n 4 -l 10 /dev/sdb /dev/sdc /dev/sdd /dev/sde
格式化RAID磁盘整理为ext4格式mkfs.ext4 /dev/md0
创建挂载目录mkdir /RAID
mount /dev/md0 /RAID
df -h
设置为系统重启也自动生效echo "/dev/md0 /RAID ext4 default 0 0" >> /etc/fstab
查看/dev/md0设备信息mdadm -D /dev/md0
接下来我们模拟一块硬盘损坏mdadm /dev/md0 -f /dev/sdb
mdadm -D /dev/md0
损坏后依然可以正常使用
因为RAID10允许一组RAID1硬盘中存在一个故障而不影响使用,所以我们任然可以使用正常点的创建或者删除文件,现在就把新的硬盘增加进去吧,当然也可以让硬盘sdb恢复使用,重启后执行以下命令mdadm /dev/md0 -a /dev/sdb
我们重启系统后发现无法启动
自动挂载的那个fstab文件有问题,你在这个界面直接输入密码,然后把你增加的删除,重启就OK
注释后,保存重启
重启后恢复正常
我们再次执行上面的操作mdadm /dev/md0 -a /dev/sdb
我们再次查看mdadm -D /dev/md0
原文地址:http://blog.51cto.com/gaowenlong/2086918