mdadm raid5:所有磁盘均显示为备用磁盘

mdadm raid5:所有磁盘均显示为备用磁盘

我拔掉了 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)

答案1

因此,经过一周的各种尝试,答案是坏块列表。在发生硬故障之前,RAID 阵列开始将所有对底层磁盘的访问添加为坏块。因此,即使通过强制阵列以“echo [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,异步页面读取”。这导致网络上没有任何结果……

相关内容