Raid

mdadm 在彙編操作期間沒有找到超級塊

  • April 7, 2021

我有零填充分區/dev/sda1並將/dev/sdb1其放入 Linux RAID:

# mdadm --create /dev/md0 --level=1 --raid-disks=2 --metadata 1.0 /dev/sda1 /dev/sdb1
mdadm: array /dev/md0 started.
#
# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sdb1[1] sda1[0]
     487360 blocks super 1.0 [2/2] [UU]

unused devices: <none>
#

如果這很重要,兩者/dev/sda1之前/dev/sdb1都是另一面鏡子的一部分。現在,在我停止新創建的md0鏡像mdadm --stop --scan並嘗試使用 重新組裝所有陣列mdadm --assemble --scan之後,/dev/md0休息時不再發現或鏡像是:

# cat /proc/mdstat
Personalities : [raid1]
md3 : active raid1 sda4[2] sdb4[1]
     892150784 blocks super 1.2 [2/2] [UU]
     bitmap: 0/7 pages [0KB], 65536KB chunk

md2 : active raid1 sda3[2] sdb3[1]
     29280256 blocks super 1.2 [2/2] [UU]

md1 : active raid1 sda2[2] sdb2[1]
     15617024 blocks super 1.2 [2/2] [UU]

unused devices: <none>
#

如果我嘗試使用詳細輸出來組裝數組,那麼它會說,在andmd0上沒有超級塊:/dev/sda1``/dev/sdb1

# mdadm -vv --assemble /dev/md0
mdadm: looking for devices for /dev/md0
mdadm: no RAID superblock on /dev/md/3
mdadm: no RAID superblock on /dev/md/2
mdadm: no RAID superblock on /dev/md/1
mdadm: no RAID superblock on /dev/sde2
mdadm: no RAID superblock on /dev/sde1
mdadm: no RAID superblock on /dev/sde
mdadm: no RAID superblock on /dev/sr1
mdadm: no RAID superblock on /dev/sdc
mdadm: no RAID superblock on /dev/sdd
mdadm: cannot open device /dev/sr0: No medium found
mdadm: /dev/sdb4 has wrong uuid.
mdadm: /dev/sdb3 has wrong uuid.
mdadm: /dev/sdb2 has wrong uuid.
mdadm: no RAID superblock on /dev/sdb1
mdadm: no RAID superblock on /dev/sdb
mdadm: /dev/sda4 has wrong uuid.
mdadm: /dev/sda3 has wrong uuid.
mdadm: /dev/sda2 has wrong uuid.
mdadm: no RAID superblock on /dev/sda1
mdadm: no RAID superblock on /dev/sda
mdadm: no RAID superblock on /dev/loop0
#

但是,如果我檢查 RAID1 成員上的超級塊數據,則它存在:

# mdadm --misc -E /dev/sda1
/dev/sda1:
         Magic : a92b4efc
       Version : 1.0
   Feature Map : 0x0
    Array UUID : 5a0545c5:e5b8c31b:0982665c:0cdfe114
          Name : ubuntu:0  (local to host ubuntu)
 Creation Time : Wed Apr  7 14:21:25 2021
    Raid Level : raid1
  Raid Devices : 2

Avail Dev Size : 974816 (476.06 MiB 499.11 MB)
    Array Size : 487360 (476.02 MiB 499.06 MB)
 Used Dev Size : 974720 (476.02 MiB 499.06 MB)
  Super Offset : 974832 sectors
  Unused Space : before=0 sectors, after=104 sectors
         State : clean
   Device UUID : 51c870bf:c75f1072:ff17ffcb:0d794b70

   Update Time : Wed Apr  7 14:21:27 2021
 Bad Block Log : 512 entries available at offset -8 sectors
      Checksum : c908caac - correct
        Events : 17


  Device Role : Active device 0
  Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
#
# mdadm --misc -E /dev/sdb1
/dev/sdb1:
         Magic : a92b4efc
       Version : 1.0
   Feature Map : 0x0
    Array UUID : 5a0545c5:e5b8c31b:0982665c:0cdfe114
          Name : ubuntu:0  (local to host ubuntu)
 Creation Time : Wed Apr  7 14:21:25 2021
    Raid Level : raid1
  Raid Devices : 2

Avail Dev Size : 974816 (476.06 MiB 499.11 MB)
    Array Size : 487360 (476.02 MiB 499.06 MB)
 Used Dev Size : 974720 (476.02 MiB 499.06 MB)
  Super Offset : 974832 sectors
  Unused Space : before=0 sectors, after=104 sectors
         State : clean
   Device UUID : e8517473:237cf164:8fb85c22:5ef79704

   Update Time : Wed Apr  7 14:21:27 2021
 Bad Block Log : 512 entries available at offset -8 sectors
      Checksum : 5a978f80 - correct
        Events : 17


  Device Role : Active device 1
  Array State : AA ('A' == active, '.' == missing, 'R' == replacing)
#

什麼可能導致這種行為?

如果您的 /etc/mdadm/mdadm.conf 文件指定具有不同元數據格式的數組,則 mdadm 將僅查找該數組而不會找到它。

引用自:https://unix.stackexchange.com/questions/643923