0

所以,这是历史:断电后,我的 RAID5 无法工作,因为需要重新添加 3 个驱动器。我启动了 mdadm --manage --re-add /dev/md0 /dev/sd[abd]1 ,就像我在电源问题后经常做的那样。

这通常需要 2 秒,但这次运行了很长时间。不幸的是,又发生了一次停电。

当前的 RAID5 不会重新组装:

# mdadm --examine /dev/sd*1
/dev/sda1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x8b
     Array UUID : 0993cb6a:f3459891:b7cdab4b:6ea12dfe
           Name : abydos:0  (local to host abydos)
  Creation Time : Sat Apr 14 16:22:03 2018
     Raid Level : raid5
   Raid Devices : 4

 Avail Dev Size : 1953193984 (931.36 GiB 1000.04 GB)
     Array Size : 2929790976 (2794.07 GiB 3000.11 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
Recovery Offset : 977060096 sectors
   Unused Space : before=262064 sectors, after=0 sectors
          State : clean
    Device UUID : 3c88a981:9bc7d431:d89b5a24:d08f46d8

Internal Bitmap : 8 sectors from superblock
    Update Time : Fri Sep 14 10:50:52 2018
  Bad Block Log : 512 entries available at offset 16 sectors - bad blocks present.
       Checksum : dcd48bf - correct
         Events : 7388

         Layout : left-symmetric
     Chunk Size : 512K

   Device Role : Active device 0
   Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdb1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x8b
     Array UUID : 0993cb6a:f3459891:b7cdab4b:6ea12dfe
           Name : abydos:0  (local to host abydos)
  Creation Time : Sat Apr 14 16:22:03 2018
     Raid Level : raid5
   Raid Devices : 4

 Avail Dev Size : 1953193984 (931.36 GiB 1000.04 GB)
     Array Size : 2929790976 (2794.07 GiB 3000.11 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
Recovery Offset : 977060096 sectors
   Unused Space : before=262064 sectors, after=0 sectors
          State : active
    Device UUID : 33272fbd:e6031c19:23768dd1:85a9bb52

Internal Bitmap : 8 sectors from superblock
    Update Time : Fri Sep 14 10:50:52 2018
  Bad Block Log : 512 entries available at offset 16 sectors - bad blocks present.
       Checksum : 58421802 - correct
         Events : 7388

         Layout : left-symmetric
     Chunk Size : 512K

   Device Role : Active device 1
   Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdc1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : 0993cb6a:f3459891:b7cdab4b:6ea12dfe
           Name : abydos:0  (local to host abydos)
  Creation Time : Sat Apr 14 16:22:03 2018
     Raid Level : raid5
   Raid Devices : 4

 Avail Dev Size : 1953260976 (931.39 GiB 1000.07 GB)
     Array Size : 2929790976 (2794.07 GiB 3000.11 GB)
  Used Dev Size : 1953193984 (931.36 GiB 1000.04 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
   Unused Space : before=262064 sectors, after=66992 sectors
          State : active
    Device UUID : c2a0569a:bdc4990d:f548e5b6:d909315d

Internal Bitmap : 8 sectors from superblock
    Update Time : Fri Sep 14 10:50:52 2018
  Bad Block Log : 512 entries available at offset 16 sectors
       Checksum : df78c9b4 - correct
         Events : 7388

         Layout : left-symmetric
     Chunk Size : 512K

   Device Role : Active device 2
   Array State : AAAA ('A' == active, '.' == missing, 'R' == replacing)
/dev/sdd1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x8b
     Array UUID : 0993cb6a:f3459891:b7cdab4b:6ea12dfe
           Name : abydos:0  (local to host abydos)
  Creation Time : Sat Apr 14 16:22:03 2018
     Raid Level : raid5
   Raid Devices : 4

 Avail Dev Size : 1953260972 (931.39 GiB 1000.07 GB)
     Array Size : 2929790976 (2794.07 GiB 3000.11 GB)
  Used Dev Size : 1953193984 (931.36 GiB 1000.04 GB)
    Data Offset : 262144 sectors
   Super Offset : 8 sectors
Recovery Offset : 977060096 sectors
   Unused Space : before=262064 sectors, after=66988 sectors
          State : active
    Device UUID : e184b5de:6a891977:e3531c58:45698c2f

Internal Bitmap : 8 sectors from superblock
    Update Time : Fri Sep 14 10:50:52 2018
  Bad Block Log : 512 entries available at offset 16 sectors - bad blocks present.
       Checksum : 3b269e62 - correct
         Events : 7388

         Layout : left-symmetric
     Chunk Size : 512K

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

虽然一切看起来都不错,但我无法重新组装:

 # mdadm --assemble --verbose --force --run /dev/md0 /dev/sd*1
mdadm: looking for devices for /dev/md0
mdadm: /dev/sda1 is identified as a member of /dev/md0, slot 0.
mdadm: /dev/sdb1 is identified as a member of /dev/md0, slot 1.
mdadm: /dev/sdc1 is identified as a member of /dev/md0, slot 2.
mdadm: /dev/sdd1 is identified as a member of /dev/md0, slot 3.
mdadm: added /dev/sdb1 to /dev/md0 as 1
mdadm: added /dev/sdc1 to /dev/md0 as 2
mdadm: added /dev/sdd1 to /dev/md0 as 3
mdadm: added /dev/sda1 to /dev/md0 as 0
mdadm: failed to RUN_ARRAY /dev/md0: Input/output error
mdadm: Not enough devices to start the array.

# cat /proc/mdstat 
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty] 
md0 : inactive sdd1[3] sdc1[2] sdb1[1] sda1[0]
      3906454958 blocks super 1.2

unused devices: <none>

请注意,没有磁盘被标记为备用。另外,在 dmesg 中,我看到:

[352041.228763] md: md127 stopped.
[352045.333213] md/raid:md127: not clean -- starting background reconstruction
[352045.333246] md/raid:md127: device sdb1 operational as raid disk 2
[352045.333672] md/raid:md127: not enough operational devices (3/4 failed)
[352045.333951] md/raid:md127: failed to run raid set.
[352045.333953] md: pers->run() failed ...

我不明白这里发生了什么,一切看起来都很好(所有磁盘上的更新时间和事件都相同),我不确定如何恢复数据。有任何想法吗 ?没有磁盘是备用的,没有磁盘过期,也没有磁盘出现故障。

4

1 回答 1

1

我认为答案很简单:RAID 不是防止电源故障的技术;相反,它是一种防止磁盘发生故障的技术(通常一次出现一个(RAID5 情况)或两个(RAID6))。使用写入缓存(在操作系统中,或在驱动器本身中),任何驱动器上都可能存在数据丢失,并且 RAID 软件只会看到太多(在 RAID5 的情况下超过一个)驱动器没有状态他们应该有。

RAID5 想要从剩余的好磁盘重建坏磁盘,但在您的情况下,软件无法检测到足够的好磁盘。

如果幸运的话,mdadmrepair动作可以使 RAID 再次一致,但这并不意味着您没有丢失数据。一旦 RAID 再次处于活动状态,您应该执行完整的文件系统检查。

于 2019-01-27T22:14:27.570 回答