假設我有以下數組:
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 沒有問題
手冊頁指出:
然而,根據裝置上的事件計數,恢復可能只需要恢復標記為寫入意圖位圖的部分,或者可能根本不需要任何恢復。
我不完全明白這意味著什麼。例如,在哪些情況下事件計數足夠接近可以重新添加?
我發現甚至停止和組裝數組也是不可能的(我的意思是數組開始但“降級”)
那麼您能否解釋一下在什麼情況下可以重新新增先前刪除的磁碟?