Mdadm

mdadm raid5:所有磁碟都顯示為備用

  • April 18, 2020

我為我的 raid 5 的 4 個磁碟中的 2 個拔掉了電源插頭。從那以後它無法啟動。即使使用 –run –force、–readwrite 等。我很快就看到了,所以數據不應該(太多)損壞。

這是詳細資訊:

/dev/md2:
          Version : 1.2
    Creation Time : Mon Oct 28 14:46:16 2019
       Raid Level : raid5
    Used Dev Size : 243138560 (231.88 GiB 248.97 GB)
     Raid Devices : 4
    Total Devices : 4
      Persistence : Superblock is persistent

      Update Time : Thu Apr  9 20:37:49 2020
            State : active, FAILED, Not Started
   Active Devices : 0
  Working Devices : 4
   Failed Devices : 0
    Spare Devices : 4

           Layout : left-symmetric
       Chunk Size : 512K

Consistency Policy : unknown

   Number   Major   Minor   RaidDevice State
      -       0        0        0      removed
      -       0        0        1      removed
      -       0        0        2      removed
      -       0        0        3      removed

      -       8       50        3      spare rebuilding   /dev/sdd2
      -       8       34        1      spare rebuilding   /dev/sdc2
      -       8       18        2      spare rebuilding   /dev/sdb2
      -       8        2        0      spare rebuilding   /dev/sda2

現在我可以簡單地用 sudo mdadm –create /dev/md2 –level=5 –raid-devices=4 –chunk=512 /dev/sdd2 /dev/sdb2 /dev/sda2 /dev 重新創建陣列/sdc2 ?我應該關心驅動器的順序,對吧?

如要求,–examine 的輸出:

/dev/sda2:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x8b
    Array UUID : 0956b1a2:4ed1052a:016155a1:940db446
          Name : raspberrypi3:2
 Creation Time : Mon Oct 28 14:46:16 2019
    Raid Level : raid5
  Raid Devices : 4

Avail Dev Size : 486277120 (231.88 GiB 248.97 GB)
    Array Size : 729415680 (695.63 GiB 746.92 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
Recovery Offset : 36416 sectors
  Unused Space : before=262056 sectors, after=0 sectors
         State : clean
   Device UUID : da9f05d3:64d47a14:78eedb5e:dd69151c

Internal Bitmap : 8 sectors from superblock
   Update Time : Thu Apr  9 20:37:49 2020
 Bad Block Log : 512 entries available at offset 72 sectors - bad blocks present.
      Checksum : ccf72dc4 - correct
        Events : 8802

        Layout : left-symmetric
    Chunk Size : 512K

  Device Role : Active device 0
  Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdb2:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x8b
    Array UUID : 0956b1a2:4ed1052a:016155a1:940db446
          Name : raspberrypi3:2
 Creation Time : Mon Oct 28 14:46:16 2019
    Raid Level : raid5
  Raid Devices : 4

Avail Dev Size : 486277120 (231.88 GiB 248.97 GB)
    Array Size : 729415680 (695.63 GiB 746.92 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
Recovery Offset : 36416 sectors
  Unused Space : before=262056 sectors, after=0 sectors
         State : active
   Device UUID : e709a92a:c10f1949:c9868538:f5cc2acc

Internal Bitmap : 8 sectors from superblock
   Update Time : Thu Apr  9 20:37:49 2020
 Bad Block Log : 512 entries available at offset 72 sectors - bad blocks present.
      Checksum : e2f7ce99 - correct
        Events : 8802

        Layout : left-symmetric
    Chunk Size : 512K

  Device Role : Active device 2
  Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc2:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x8b
    Array UUID : 0956b1a2:4ed1052a:016155a1:940db446
          Name : raspberrypi3:2
 Creation Time : Mon Oct 28 14:46:16 2019
    Raid Level : raid5
  Raid Devices : 4

Avail Dev Size : 486277120 (231.88 GiB 248.97 GB)
    Array Size : 729415680 (695.63 GiB 746.92 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
Recovery Offset : 36416 sectors
  Unused Space : before=262056 sectors, after=0 sectors
         State : active
   Device UUID : e1c4f361:af07c81c:1e6b8f72:962869a5

Internal Bitmap : 8 sectors from superblock
   Update Time : Thu Apr  9 20:37:49 2020
 Bad Block Log : 512 entries available at offset 72 sectors - bad blocks present.
      Checksum : 139c176 - correct
Events : 8801

        Layout : left-symmetric
    Chunk Size : 512K

  Device Role : Active device 1
  Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdd2:
         Magic : a92b4efc
       Version : 1.2
   Feature Map : 0x8b
    Array UUID : 0956b1a2:4ed1052a:016155a1:940db446
          Name : raspberrypi3:2
 Creation Time : Mon Oct 28 14:46:16 2019
    Raid Level : raid5
  Raid Devices : 4

Avail Dev Size : 486277120 (231.88 GiB 248.97 GB)
    Array Size : 729415680 (695.63 GiB 746.92 GB)
   Data Offset : 262144 sectors
  Super Offset : 8 sectors
Recovery Offset : 36416 sectors
  Unused Space : before=262056 sectors, after=0 sectors
         State : active
   Device UUID : ce27edb8:365853c7:e0434b32:5ae01e33

Internal Bitmap : 8 sectors from superblock
   Update Time : Thu Apr  9 20:37:49 2020
 Bad Block Log : 512 entries available at offset 72 sectors - bad blocks present.
      Checksum : 50300573 - correct
        Events : 8801

        Layout : left-symmetric
    Chunk Size : 512K

  Device Role : Active device 3
  Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)

因此,經過一周的各種嘗試,答案是壞塊列表。在硬故障之前,raid 陣列開始將所有對底層磁碟的訪問添加為壞塊。因此,即使通過強制陣列以“迴聲”開頭,也可以很好地組裝磁碟

$$ X,Y,Z,W $$| sudo tee /sys/block/md2/md/dev-sd$$ a,b,c,d $$2/slot" 訪問 /dev/mdX 時會導致 I/O 錯誤。 所以我用“sudo mdadm –assemble –update=force-no-bbl /dev/md2 /dev/sda2 /dev/sdd2 /dev/sdc2 /dev/sdb2”強制陣列開始忽略阻止列表。瘋狂的是沒有任何線索的原因。我剛剛遇到“dev md2 上的緩衝區 I/O 錯誤,邏輯塊 0,非同步頁面讀取”。這導致網路上什麼都沒有……

引用自:https://serverfault.com/questions/1011650