Centos 7 冗余备份磁盘配置介绍 我们上一盘介绍了Centos 7 磁盘阵列配置介绍,今天继续上一篇的配置介绍,通过上一篇的配置介绍我们发现了一个问题。,运维人员需要在硬盘硬件出现故障后,手动增加新的硬盘进去,这样很不方便,比如初始化RAID5整列是直接给与4块硬盘,其中一块硬盘设备用于在阵列某个硬盘出现故障自动替换上去,这样是不是很方便呢,那我们今天就介绍一下配置冗余备份磁盘,具体见下: 先将量磁盘系统卸载 `umount /dev/md0` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/5ed55a8b44081dc22ff39f65bcfd73c4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 停止该阵列设备,彻底的停用 `mdadm -S /dev/md0` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/710f905fadca11ddda295d7c3f1d4966.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) `mdadm -D /dev/md0` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/a756e1fa842945a0ca352b407526d7cd.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 我们创建一个RAID5并且设置一块备份故障盘 `mdadm -Cv /dev/md0 -n 3 -l 5 -x 1 /dev/sdb /dev/sdc /dev/sdd /dev/sde` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/b90b12cebb705535d0cd1ff58fe0a8b8.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 查看阵列 `mdadm /D /dev/md0` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/a73baf1bda601d6c4c788a2eeae45146.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 我们等待了一会后,发现rebuild完成了,然后再次查看 ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/32d7e6cbcb64827e48dcb1a384beaa92.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 然后我们接下来就是格式化ext4 `mkfs.ext4 /dev/md0` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/459938c0c184003b40b792083ea7ad18.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 因为我们前面设置过fstab文件,所以现在可以直接挂在 `mount -a` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/5d7557d771f098de699bdcbe94febd70.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 我们将/dev/sdb设备设置为故障并且移除阵列 `mdadm /dev/md0 -f /dev/sdb` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/a854193394d6056dbe0cb1d683c9c6a6.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) 接下来我们查看是否自动将sde直接顶替上去了 `mdadm -D /dev/md0` ![磁盘阵列 RAID](https://s4.51cto.com/images/blog/201803/14/364172fad6f32f47bb52088782459ce4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)