恢复 mdadm 阵列

恢复 mdadm 阵列

我有一个 raid5 阵列,其上带有 mdadm 和 btrfs 文件系统。

我的 SATA 卡坏了,所有驱动器同时掉线。如果我想重建阵列或恢复一些数据,该怎么办?

❯ mdadm --assemble /dev/md1 /dev/sd{a,b,c}1
mdadm: /dev/md1 assembled from 2 drives - not enough to start the array while not clean - consider --force.

磁盘

/dev/sda1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : ba8c1771:df7e45f2:063b1246:05891191
           Name : katiska:1  (local to host katiska)
  Creation Time : Thu Jun 14 21:03:10 2018
     Raid Level : raid5
   Raid Devices : 3

 Avail Dev Size : 15626733761 (7451.41 GiB 8000.89 GB)
     Array Size : 15626733568 (14902.81 GiB 16001.78 GB)
  Used Dev Size : 15626733568 (7451.41 GiB 8000.89 GB)
    Data Offset : 264192 sectors
   Super Offset : 8 sectors
   Unused Space : before=264112 sectors, after=193 sectors
          State : clean
    Device UUID : 018cd45f:c26466b2:b78dcdf6:14cf437c

Internal Bitmap : 8 sectors from superblock
    Update Time : Thu May 20 19:50:44 2021
  Bad Block Log : 512 entries available at offset 40 sectors
       Checksum : f7f9e3e - correct
         Events : 67116

         Layout : left-symmetric
     Chunk Size : 512K

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


/dev/sdb1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : ba8c1771:df7e45f2:063b1246:05891191
           Name : katiska:1  (local to host katiska)
  Creation Time : Thu Jun 14 21:03:10 2018
     Raid Level : raid5
   Raid Devices : 3

 Avail Dev Size : 15626733761 (7451.41 GiB 8000.89 GB)
     Array Size : 15626733568 (14902.81 GiB 16001.78 GB)
  Used Dev Size : 15626733568 (7451.41 GiB 8000.89 GB)
    Data Offset : 264192 sectors
   Super Offset : 8 sectors
   Unused Space : before=264112 sectors, after=193 sectors
          State : active
    Device UUID : f8bfaec3:c6e18862:c8bf98aa:ff6d76d3

Internal Bitmap : 8 sectors from superblock
    Update Time : Thu May 20 19:50:44 2021
  Bad Block Log : 512 entries available at offset 40 sectors
       Checksum : 2e7a2036 - correct
         Events : 67116

         Layout : left-symmetric
     Chunk Size : 512K

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


/dev/sdc1:
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x1
     Array UUID : ba8c1771:df7e45f2:063b1246:05891191
           Name : katiska:1  (local to host katiska)
  Creation Time : Thu Jun 14 21:03:10 2018
     Raid Level : raid5
   Raid Devices : 3

 Avail Dev Size : 15626733761 (7451.41 GiB 8000.89 GB)
     Array Size : 15626733568 (14902.81 GiB 16001.78 GB)
  Used Dev Size : 15626733568 (7451.41 GiB 8000.89 GB)
    Data Offset : 264192 sectors
   Super Offset : 8 sectors
   Unused Space : before=264112 sectors, after=193 sectors
          State : active
    Device UUID : e2b419e2:740f7472:e2673b3f:1b85e78e

Internal Bitmap : 8 sectors from superblock
    Update Time : Thu May 20 08:11:26 2021
  Bad Block Log : 512 entries available at offset 40 sectors
       Checksum : ace65e12 - correct
         Events : 67104

         Layout : left-symmetric
     Chunk Size : 512K

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

更新

成功恢复 raid 阵列

mdadm -A /dev/md1 /dev/sd{a,b,c}1 --run
mdadm --manage /dev/md1 --re-add /dev/sdc1

下一个问题:无法挂载 btrfs

❯ mount -t btrfs -o rescue=usebackuproot,ro /dev/md1 /mnt/temp
mount: /mnt/temp: wrong fs type, bad option, bad superblock on /dev/md1, missing codepage or helper program, or other error.
[10190.135565] BTRFS info (device md1): disk space caching is enabled
[10190.135569] BTRFS info (device md1): has skinny extents
[10190.163782] BTRFS warning (device md1): md1 checksum verify failed on 15010356396032 wanted 0x8987ec1e found 0x789cbf92 level 0
[10190.173774] BTRFS warning (device md1): md1 checksum verify failed on 15010356396032 wanted 0x8987ec1e found 0xd7d40b0c level 0
[10190.178144] BTRFS error (device md1): open_ctree failed
[11500.765935] BTRFS info (device md1): disk space caching is enabled
[11500.765939] BTRFS info (device md1): has skinny extents
[11500.777820] BTRFS warning (device md1): md1 checksum verify failed on 15010356396032 wanted 0x8987ec1e found 0x789cbf92 level 0
[11500.778080] BTRFS warning (device md1): md1 checksum verify failed on 15010356396032 wanted 0x8987ec1e found 0xd7d40b0c level 0
[11500.781900] BTRFS error (device md1): open_ctree failed
[11520.303508] BTRFS info (device md1): trying to use backup root at mount time
[11520.303512] BTRFS info (device md1): disk space caching is enabled
[11520.303514] BTRFS info (device md1): has skinny extents
[11520.315506] BTRFS warning (device md1): md1 checksum verify failed on 15010356396032 wanted 0x8987ec1e found 0x789cbf92 level 0
[11520.315789] BTRFS warning (device md1): md1 checksum verify failed on 15010356396032 wanted 0x8987ec1e found 0xd7d40b0c level 0
[11520.327828] BTRFS warning (device md1): md1 checksum verify failed on 15010810200064 wanted 0xf1075186 found 0x6ca75504 level 1
[11520.339219] BTRFS warning (device md1): md1 checksum verify failed on 15010810200064 wanted 0xf1075186 found 0x852a01da level 1
[11520.339249] BTRFS warning (device md1): couldn't read tree root
[11520.362819] BTRFS warning (device md1): md1 checksum verify failed on 15010503720960 wanted 0x935a324a found 0x5650ea9c level 0
[11520.367594] BTRFS warning (device md1): md1 checksum verify failed on 15010503720960 wanted 0x935a324a found 0xafd9864c level 0
[11520.367632] BTRFS warning (device md1): failed to read root (objectid=2): -5
[11520.394231] BTRFS warning (device md1): md1 checksum verify failed on 15010750889984 wanted 0x931bab07 found 0x0f2762ce level 0
[11520.404879] BTRFS warning (device md1): md1 checksum verify failed on 15010750906368 wanted 0x4401f488 found 0x32eb0079 level 1
[11520.412086] BTRFS warning (device md1): md1 checksum verify failed on 15010681831424 wanted 0x82ae1313 found 0xe84c4e28 level 3
[11520.418751] BTRFS warning (device md1): md1 checksum verify failed on 15010750808064 wanted 0x0049e089 found 0xc2396cf4 level 0
[11521.258858] BTRFS info (device md1): bdev /dev/md1 errs: wr 0, rd 0, flush 0, corrupt 46058, gen 0
[11528.370856] BTRFS warning (device md1): md1 checksum verify failed on 15010812575744 wanted 0x0c452e3c found 0xcb52f1e8 level 0
[11529.504911] BTRFS warning (device md1): md1 checksum verify failed on 15010732392448 wanted 0x082ad69d found 0x3296674f level 0
[11541.816670] BTRFS warning (device md1): md1 checksum verify failed on 15010343796736 wanted 0x9e58df43 found 0x32499015 level 0
[11541.845590] BTRFS error (device md1): bad fsid on block 15010342305792
[11545.602906] BTRFS warning (device md1): md1 checksum verify failed on 15010749923328 wanted 0xedee0fe0 found 0x6f20c2e2 level 0
[11546.852447] BTRFS warning (device md1): md1 checksum verify failed on 15010750529536 wanted 0x217a7a5b found 0x3fea3593 level 0
[11546.861508] BTRFS warning (device md1): md1 checksum verify failed on 15010750529536 wanted 0x217a7a5b found 0x3e670042 level 0
[11546.861530] BTRFS error (device md1): failed to read block groups: -5
[11546.886194] BTRFS error (device md1): open_ctree failed

相关内容