假设我有以下数组:
mdadm -Q --detail /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Fri Oct 29 17:35:52 2021
Raid Level : raid1
Array Size : 8382464 (7.99 GiB 8.58 GB)
Used Dev Size : 8382464 (7.99 GiB 8.58 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Sat Oct 30 07:29:40 2021
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Consistency Policy : resync
Name : debian:0 (local to host debian)
UUID : 423096f2:994556ee:1a3ff40e:75475fc5
Events : 317
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
2 8 65 1 active sync /dev/sde1
然后,我模拟故障并删除故障磁盘:
mdadm /dev/md0 --verbose --fail /dev/sde1
mdadm: set /dev/sde1 faulty in /dev/md0
mdadm /dev/md0 --verbose --remove /dev/sde1
mdadm: hot removed /dev/sde1 from /dev/md0
这是数组组件的元数据:
mdadm -E /dev/sdb1
/dev/sdb1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 423096f2:994556ee:1a3ff40e:75475fc5
Name : debian:0 (local to host debian)
Creation Time : Fri Oct 29 17:35:52 2021
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 16764928 (7.99 GiB 8.58 GB)
Array Size : 8382464 (7.99 GiB 8.58 GB)
Data Offset : 10240 sectors
Super Offset : 8 sectors
Unused Space : before=10160 sectors, after=0 sectors
State : clean
Device UUID : 701db404:61dbf37b:933d61d0:42b02759
Update Time : Sat Oct 30 07:30:15 2021
Bad Block Log : 512 entries available at offset 16 sectors
Checksum : 6739499b - correct
Events : 328
Device Role : Active device 0
Array State : A. ('A' == active, '.' == missing, 'R' == replacing)
mdadm -E /dev/sde1
/dev/sde1:
Magic : a92b4efc
Version : 1.2
Feature Map : 0x0
Array UUID : 423096f2:994556ee:1a3ff40e:75475fc5
Name : debian:0 (local to host debian)
Creation Time : Fri Oct 29 17:35:52 2021
Raid Level : raid1
Raid Devices : 2
Avail Dev Size : 16764928 (7.99 GiB 8.58 GB)
Array Size : 8382464 (7.99 GiB 8.58 GB)
Data Offset : 10240 sectors
Super Offset : 8 sectors
Unused Space : before=10160 sectors, after=0 sectors
State : clean
Device UUID : 779a1bbf:68684dcc:6efb0c73:af2c0759
Update Time : Sat Oct 30 07:29:40 2021
Bad Block Log : 512 entries available at offset 16 sectors
Checksum : 14848dc8 - correct
Events : 317
Device Role : Active device 1
Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
但如果我尝试重新添加它会发生什么:
mdadm /dev/md0 --verbose --re-add /dev/sde1
mdadm: --re-add for /dev/sde1 to /dev/md0 is not possible
但是,我可以 --add 没有问题
手册页指出:
然而,根据设备上的事件计数,恢复可能只需要恢复标记为写入意图位图的部分,或者可能根本不需要任何恢复。
我不完全明白这意味着什么。例如,在哪些情况下事件计数足够接近可以重新添加?
我发现甚至停止和组装数组也是不可能的(我的意思是数组开始但“降级”)
那么您能否解释一下在什么情况下可以重新添加之前删除的磁盘?