raid10故障修复
当raid10故障了一块硬盘怎么办?
1、模拟挂掉了一块硬盘,从raid10的四块硬盘组中,剔除一块硬盘
[root@WALKER /]# fdisk -l|grep sd[a-z]
磁盘 /dev/sda:32.2 GB, 32212254720 字节,62914560 个扇区
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 62914559 30407680 8e Linux LVM
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
磁盘 /dev/sdd:10.7 GB, 10737418240 字节,20971520 个扇区
磁盘 /dev/sde:10.7 GB, 10737418240 字节,20971520 个扇区
磁盘 /dev/sdf:10.7 GB, 10737418240 字节,20971520 个扇区
[root@WALKER /]#
2、剔除raid10中的一块硬盘
[root@WALKER /]# mdadm /dev/md0 -f /dev/sdd
mdadm: set /dev/sdd faulty in /dev/md0
[root@WALKER /]#
3、检查raid10状态
[root@WALKER /]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun May 22 10:58:44 2022
Raid Level : raid10
Array Size : 20936704 (19.97 GiB 21.44 GB)
Used Dev Size : 10468352 (9.98 GiB 10.72 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Sun May 22 12:21:42 2022
State : clean, degraded
Active Devices : 3
Working Devices : 3
Failed Devices : 1
Spare Devices : 0
Layout : near=2
Chunk Size : 512K
Consistency Policy : resync
Name : WALKER:0 (local to host WALKER)
UUID : ad8c4653:8db8584c:b8b003a9:a00c5565
Events : 19
Number Major Minor RaidDevice State
0 8 16 0 active sync set-A /dev/sdb
1 8 32 1 active sync set-B /dev/sdc
- 0 0 2 removed
3 8 64 3 active sync set-B /dev/sde
2 8 48 - faulty /dev/sdd
[root@WALKER /]# cd /mdadm/
[root@WALKER mdadm]# ls
test1.txt test2.txt test3.txt test.txt
[root@WALKER mdadm]# cp test.txt test4.txt
[root@WALKER mdadm]#
我们发现,挂掉了一块硬盘后不影响我们使用md0!
4、只需要购买新的硬盘设备重新加入raid10阵列组当中即可!
注意:得重启机器,重新读取信息!
(1)重新加入硬盘阵列,必须先取消挂载
[root@WALKER /]# umount /dev/md0
[root@WALKER /]#
(2)重新添加新的硬盘,加入至/dev/md0阵列组中
[root@WALKER /]# mdadm /dev/md0 -a /dev/sdd
mdadm: Cannot open /dev/sdd: Device or resource busy(这个地方就是因为没有重启,所以报错了!)
[root@WALKER /]# reboot
可能你的设备设置了开启自动挂载,重启了之后,还得取消挂载!
[root@WALKER ~]# mdadm /dev/md0 -a /dev/sdd
mdadm: added /dev/sdd
[root@WALKER ~]#
5、此时可以检查磁盘阵列组的信息,等待修复
[root@WALKER ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sun May 22 10:58:44 2022
Raid Level : raid10
Array Size : 20936704 (19.97 GiB 21.44 GB)
Used Dev Size : 10468352 (9.98 GiB 10.72 GB)
Raid Devices : 4
Total Devices : 4
Persistence : Superblock is persistent
Update Time : Sun May 22 12:39:04 2022
State : clean
Active Devices : 4
Working Devices : 4
Failed Devices : 0
Spare Devices : 0
Layout : near=2
Chunk Size : 512K
Consistency Policy : resync
Name : WALKER:0 (local to host WALKER)
UUID : ad8c4653:8db8584c:b8b003a9:a00c5565
此时,修复完毕,且激活的设备回到了4块硬盘,raid10故障修复完毕!