[root@haproxy-node-a home]# mdadm -E /dev/md0 mdadm: No md superblock detected on /dev/md0. [root@haproxy-node-a home]# mdadm -D /dev/md0 /dev/md0: Version : 1.2 Creation Time : Fri Sep 16 14:04:54 2022 Raid Level : raid5 Array Size : 83816448 (79.93 GiB 85.83 GB) Used Dev Size : 20954112 (19.98 GiB 21.46 GB) Raid Devices : 5 Total Devices : 6 Persistence : Superblock is persistent
Update Time : Sat Sep 17 12:35:48 2022 State : clean Active Devices : 5 Working Devices : 6 Failed Devices : 0 Spare Devices : 1
Layout : left-symmetric Chunk Size : 512K
Consistency Policy : resync
Name : haproxy-node-a:0 (local to host haproxy-node-a) UUID : 7860ea0c:fb5693d3:176f627f:be6979c7 Events : 149
Number Major Minor RaidDevice State 0 252 16 0 active sync /dev/vdb 1 252 32 1 active sync /dev/vdc 4 252 48 2 active sync /dev/vdd 5 252 80 3 active sync /dev/vdf 3 252 64 4 active sync /dev/vde
6 252 96 - spare /dev/vdg
在md0挂载的目录中创建一个文件test.txt。 内容如下:
1 2
[root@haproxy-node-a home]# cat test.txt this is a test file!
[root@haproxy-node-a home]# mdadm -D /dev/md0 /dev/md0: Version : 1.2 Creation Time : Fri Sep 16 14:04:54 2022 Raid Level : raid5 Array Size : 83816448 (79.93 GiB 85.83 GB) Used Dev Size : 20954112 (19.98 GiB 21.46 GB) Raid Devices : 5 Total Devices : 6 Persistence : Superblock is persistent
Update Time : Sat Sep 17 13:02:45 2022 State : clean Active Devices : 5 Working Devices : 5 Failed Devices : 1 Spare Devices : 0
Layout : left-symmetric Chunk Size : 512K
Consistency Policy : resync
Name : haproxy-node-a:0 (local to host haproxy-node-a) UUID : 7860ea0c:fb5693d3:176f627f:be6979c7 Events : 176
Number Major Minor RaidDevice State 0 252 16 0 active sync /dev/vdb 1 252 32 1 active sync /dev/vdc 4 252 48 2 active sync /dev/vdd 5 252 80 3 active sync /dev/vdf 6 252 96 4 active sync /dev/vdg # 热备盘已经正常同步。
3 252 64 - faulty /dev/vde
我们可以验证,在一块磁盘故障的情况下,数据是否存在变化。
1 2 3 4 5
[root@haproxy-node-a home]# ll total 4 -rw-r--r--. 1 root root 21 Sep 17 12:34 test.txt [root@haproxy-node-a home]# cat test.txt this is a test file!
[root@haproxy-node-a home]# mdadm /dev/md0 -r /dev/vde mdadm: hot removed /dev/vde from /dev/md0 # 移除了故障的磁盘 [root@haproxy-node-a home]# mdadm -D /dev/md0 /dev/md0: Version : 1.2 Creation Time : Fri Sep 16 14:04:54 2022 Raid Level : raid5 Array Size : 83816448 (79.93 GiB 85.83 GB) Used Dev Size : 20954112 (19.98 GiB 21.46 GB) Raid Devices : 5 Total Devices : 5 Persistence : Superblock is persistent
Update Time : Sat Sep 17 13:08:40 2022 State : clean Active Devices : 5 Working Devices : 5 Failed Devices : 0 Spare Devices : 0
Layout : left-symmetric Chunk Size : 512K
Consistency Policy : resync
Name : haproxy-node-a:0 (local to host haproxy-node-a) UUID : 7860ea0c:fb5693d3:176f627f:be6979c7 Events : 177
Number Major Minor RaidDevice State 0 252 16 0 active sync /dev/vdb 1 252 32 1 active sync /dev/vdc 4 252 48 2 active sync /dev/vdd 5 252 80 3 active sync /dev/vdf 6 252 96 4 active sync /dev/vdg
Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xa29b128b.
Command (m forhelp): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): Using default value 41943039 Partition 1 of type Linux and of size 20 GiB is set
Command (m forhelp): t Selected partition 1 Hex code (type L to list all codes): fd Changed type of partition 'Linux' to 'Linux raid autodetect'
Command (m forhelp): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
[root@haproxy-node-a home]# mdadm -D /dev/md0 /dev/md0: Version : 1.2 Creation Time : Fri Sep 16 14:04:54 2022 Raid Level : raid5 Array Size : 83816448 (79.93 GiB 85.83 GB) Used Dev Size : 20954112 (19.98 GiB 21.46 GB) Raid Devices : 5 Total Devices : 6 Persistence : Superblock is persistent
Update Time : Sat Sep 17 13:23:08 2022 State : clean Active Devices : 5 Working Devices : 6 Failed Devices : 0 Spare Devices : 1
Layout : left-symmetric Chunk Size : 512K
Consistency Policy : resync
Name : haproxy-node-a:0 (local to host haproxy-node-a) UUID : 7860ea0c:fb5693d3:176f627f:be6979c7 Events : 178
Number Major Minor RaidDevice State 0 252 16 0 active sync /dev/vdb 1 252 32 1 active sync /dev/vdc 4 252 48 2 active sync /dev/vdd 5 252 80 3 active sync /dev/vdf 6 252 96 4 active sync /dev/vdg