mdadm 增长和 resize2fs 成功后 Ext4 超级块损坏

mdadm 增长和 resize2fs 成功后 Ext4 超级块损坏

一些系统细节

  • AMD Phenom II X6 1090T,16GB DDR3 1600,运行 11.04 natty,2.6.38-8-server
  • 此次袭击由5 SATA drives; 4 Samsung, 1 Western Digital;组成,500 GB每个
  • 驱动器连接到LSI SAS 9201-16i主机总线适配卡
  • Raid 是基于软件的,使用mdadm。另外两个阵列(/dev/md1/dev/md2)不存在任何问题。

所以我的突袭完蛋了。目前我几乎已经力不从心了,所以我希望这里有人能给我指点迷津。正如我下面提到的,我已经花了 16 个小时左右的时间(中间休息了一下以理清思绪!)我一直在阅读这里和其他地方能找到的一切。大多数建议都是一样的,而且并不鼓舞人心,但我希望能引起比我更有知识的人的注意。

所以... 昨天我尝试向我的 RAID 5 阵列添加一个额外的驱动器。为此,我关闭了盒子的电源,插入了新的驱动器,然后重新启动了机器。到目前为止一切顺利。

然后我卸载了阵列

% sudo umount /dev/md0

并继续进行文件系统检查。

% sudo e2fsck -f /dev/md0

一切都很好。

我在新驱动器上创建了一个主分区/dev/sdh1,并将其设置为类型Linux raid autodetect。写入磁盘并退出。

我将新驱动器添加到阵列中

% sudo mdadm --add /dev/md0 /dev/sdh1

并接着

sudo mdadm --grow --raid-devices=5 --backup-file=/home/foundation/grow_md0.bak /dev/md0

(如果您此时因为备份而充满希望,请不要这样,该文件不存在于我的文件系统中,但我记得输入过它,并且它在我的 bash 历史记录中)

再次,一切似乎都很好。我让它静置,让它完成工作。完成后,没有任何错误,我e2fsck -f /dev/md0再次运行。仍然没有什么异常。此时,我有足够的信心调整它的大小。

% sudo resize2fs /dev/md0

这一切毫无声响地完成了。为了完整起见,我关闭了盒子并等待它重新启动。

在启动过程中尝试分区失败。阵列组装似乎没有出现任何问题,但安装失败,因为无法找到 EXT4 文件系统。

部分内容dmesg如下:

# [    9.237762] md: bind<sdh1>
# [    9.246063] md: bind<sdo>
# [    9.248308] md: bind<sdn>
# [    9.249661] bio: create slab <bio-1> at 1
# [    9.249668] md/raid0:md2: looking at sdn
# [    9.249669] md/raid0:md2:   comparing sdn(1953524992) with sdn(1953524992)
# [    9.249671] md/raid0:md2:   END
# [    9.249672] md/raid0:md2:   ==> UNIQUE
# [    9.249673] md/raid0:md2: 1 zones
# [    9.249674] md/raid0:md2: looking at sdo
# [    9.249675] md/raid0:md2:   comparing sdo(1953524992) with sdn(1953524992)
# [    9.249676] md/raid0:md2:   EQUAL
# [    9.249677] md/raid0:md2: FINAL 1 zones
# [    9.249679] md/raid0:md2: done.
# [    9.249680] md/raid0:md2: md_size is 3907049984 sectors.
# [    9.249681]         md2 configuration          
# [    9.249682] zone0=[sdn/sdo/]
# [    9.249683]         zone offset=0kb device offset=0kb size=1953524992kb
# [    9.249684]                                   
# [    9.249685] 
# [    9.249690] md2: detected capacity change from 0 to 2000409591808
# [    9.250162] sd 2:0:7:0: [sdk] Write Protect is off
# [    9.250164] sd 2:0:7:0: [sdk] Mode Sense: 73 00 00 08
# [    9.250331]  md2: unknown partition table
# [    9.252371] sd 2:0:7:0: [sdk] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
# [    9.252642] sd 2:0:9:0: [sdm] Write Protect is off
# [    9.252644] sd 2:0:9:0: [sdm] Mode Sense: 73 00 00 08
# [    9.254798] sd 2:0:9:0: [sdm] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
# [    9.256555]  sdg: sdg1
# [    9.261439] sd 2:0:8:0: [sdl] Write Protect is off
# [    9.261441] sd 2:0:8:0: [sdl] Mode Sense: 73 00 00 08
# [    9.263594] sd 2:0:8:0: [sdl] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
# [    9.302372]  sdf: sdf1
# [    9.310770] md: bind<sdd1>
# [    9.317153]  sdj: sdj1
# [    9.327325]  sdi: sdi1
# [    9.327686] md: bind<sde1>
# [    9.372897] sd 2:0:3:0: [sdg] Attached SCSI disk
# [    9.391630]  sdm: sdm1
# [    9.397435]  sdk: sdk1
# [    9.400372]  sdl: sdl1
# [    9.424751] sd 2:0:6:0: [sdj] Attached SCSI disk
# [    9.439342] sd 2:0:5:0: [sdi] Attached SCSI disk
# [    9.450533] sd 2:0:2:0: [sdf] Attached SCSI disk
# [    9.464315] md: bind<sdg1>
# [    9.534946] md: bind<sdj1>
# [    9.541004] md: bind<sdf1>

  [    9.542537] md/raid:md0: device sdf1 operational as raid disk 2
  [    9.542538] md/raid:md0: device sdg1 operational as raid disk 3
  [    9.542540] md/raid:md0: device sde1 operational as raid disk 1
  [    9.542541] md/raid:md0: device sdd1 operational as raid disk 0
  [    9.542879] md/raid:md0: allocated 5334kB
  [    9.542918] md/raid:md0: raid level 5 active with 4 out of 5 devices, algorithm 2
  [    9.542923] RAID conf printout:
  [    9.542924]  --- level:5 rd:5 wd:4
  [    9.542925]  disk 0, o:1, dev:sdd1
  [    9.542926]  disk 1, o:1, dev:sde1
  [    9.542927]  disk 2, o:1, dev:sdf1
  [    9.542927]  disk 3, o:1, dev:sdg1
  [    9.542928]  disk 4, o:1, dev:sdh1
  [    9.542944] md0: detected capacity change from 0 to 2000415883264
  [    9.542959] RAID conf printout:
  [    9.542962]  --- level:5 rd:5 wd:4
  [    9.542963]  disk 0, o:1, dev:sdd1
  [    9.542964]  disk 1, o:1, dev:sde1
  [    9.542965]  disk 2, o:1, dev:sdf1
  [    9.542966]  disk 3, o:1, dev:sdg1
  [    9.542967]  disk 4, o:1, dev:sdh1
  [    9.542968] RAID conf printout:
  [    9.542969]  --- level:5 rd:5 wd:4
  [    9.542970]  disk 0, o:1, dev:sdd1
  [    9.542971]  disk 1, o:1, dev:sde1
  [    9.542972]  disk 2, o:1, dev:sdf1
  [    9.542972]  disk 3, o:1, dev:sdg1
  [    9.542973]  disk 4, o:1, dev:sdh1
  [    9.543005] md: recovery of RAID array md0
  [    9.543007] md: minimum _guaranteed_  speed: 1000 KB/sec/disk.
  [    9.543008] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for recovery.
  [    9.543013] md: using 128k window, over a total of 488382784 blocks.
  [    9.543014] md: resuming recovery of md0 from checkpoint.

# [    9.549495] sd 2:0:9:0: [sdm] Attached SCSI disk
# [    9.555022] sd 2:0:8:0: [sdl] Attached SCSI disk
# [    9.555612] sd 2:0:7:0: [sdk] Attached SCSI disk
# [    9.561410] md: bind<sdi1>

  [    9.565538]  md0: unknown partition table

# [    9.639444] md: bind<sdm1>
# [    9.642729] md: bind<sdk1>
# [    9.650048] md: bind<sdl1>
# [    9.652342] md/raid:md1: device sdl1 operational as raid disk 3
# [    9.652343] md/raid:md1: device sdk1 operational as raid disk 2
# [    9.652345] md/raid:md1: device sdm1 operational as raid disk 4
# [    9.652346] md/raid:md1: device sdi1 operational as raid disk 0
# [    9.652347] md/raid:md1: device sdj1 operational as raid disk 1
# [    9.652627] md/raid:md1: allocated 5334kB
# [    9.652654] md/raid:md1: raid level 5 active with 5 out of 5 devices, algorithm 2
# [    9.652655] RAID conf printout:
# [    9.652656]  --- level:5 rd:5 wd:5
# [    9.652657]  disk 0, o:1, dev:sdi1
# [    9.652658]  disk 1, o:1, dev:sdj1
# [    9.652658]  disk 2, o:1, dev:sdk1
# [    9.652659]  disk 3, o:1, dev:sdl1
# [    9.652660]  disk 4, o:1, dev:sdm1
# [    9.652676] md1: detected capacity change from 0 to 3000614518784
# [    9.654507]  md1: unknown partition table
# [   11.093897] vesafb: framebuffer at 0xfd000000, mapped to 0xffffc90014200000, using 1536k, total 1536k
# [   11.093899] vesafb: mode is 1024x768x16, linelength=2048, pages=0
# [   11.093901] vesafb: scrolling: redraw
# [   11.093903] vesafb: Truecolor: size=0:5:6:5, shift=0:11:5:0
# [   11.094010] Console: switching to colour frame buffer device 128x48
# [   11.206677] fb0: VESA VGA frame buffer device
# [   11.301061] EXT4-fs (sda1): re-mounted. Opts: user_xattr,errors=remount-ro
# [   11.428472] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: user_xattr
# [   11.896204] EXT4-fs (sdc6): mounted filesystem with ordered data mode. Opts: user_xattr
# [   12.262728] r8169 0000:01:00.0: eth0: link up
# [   12.263975] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
# [   13.528097] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Opts: user_xattr
# [   13.681339] EXT4-fs (md2): mounted filesystem with ordered data mode. Opts: user_xattr
# [   14.310098] EXT4-fs (md1): mounted filesystem with ordered data mode. Opts: user_xattr
# [   14.357675] EXT4-fs (sdc5): mounted filesystem with ordered data mode. Opts: user_xattr
# [   16.933348] audit_printk_skb: 9 callbacks suppressed
# [   22.350011] eth0: no IPv6 routers present
# [   27.094760] ppdev: user-space parallel port driver
# [   27.168812] kvm: Nested Virtualization enabled
# [   27.168814] kvm: Nested Paging enabled
# [   30.383664] EXT4-fs (sda1): re-mounted. Opts: user_xattr,errors=remount-ro,commit=0
# [   30.385125] EXT4-fs (sdb1): re-mounted. Opts: user_xattr,commit=0
# [   32.105044] EXT4-fs (sdc6): re-mounted. Opts: user_xattr,commit=0
# [   33.078017] EXT4-fs (sdc1): re-mounted. Opts: user_xattr,commit=0
# [   33.079491] EXT4-fs (md2): re-mounted. Opts: user_xattr,commit=0
# [   33.082411] EXT4-fs (md1): re-mounted. Opts: user_xattr,commit=0
# [   35.369796] EXT4-fs (sdc5): re-mounted. Opts: user_xattr,commit=0
# [   35.674390] CE: hpet increased min_delta_ns to 20113 nsec
# [   35.676242] CE: hpet increased min_delta_ns to 30169 nsec
# [   35.677808] CE: hpet increased min_delta_ns to 45253 nsec
# [   35.679349] CE: hpet increased min_delta_ns to 67879 nsec
# [   35.680312] CE: hpet increased min_delta_ns to 101818 nsec
# [   35.680312] CE: hpet increased min_delta_ns to 152727 nsec
# [   35.680312] CE: hpet increased min_delta_ns to 229090 nsec
# [   35.680312] CE: hpet increased min_delta_ns to 343635 nsec
# [   35.681590] CE: hpet increased min_delta_ns to 515452 nsec
# [  436.595366] EXT4-fs (md2): mounted filesystem with ordered data mode. Opts: user_xattr
# [  607.364501] exe (14663): /proc/14663/oom_adj is deprecated, please use /proc/14663/oom_score_adj instead.

  [ 2016.476772] EXT4-fs (md0): VFS: Can't find ext4 filesystem
  [ 2246.923154] EXT4-fs (md0): VFS: Can't find ext4 filesystem
  [ 2293.383934] EXT4-fs (md0): VFS: Can't find ext4 filesystem
  [ 2337.292080] EXT4-fs (md0): VFS: Can't find ext4 filesystem
  [ 2364.812150] EXT4-fs (md0): VFS: Can't find ext4 filesystem
  [ 2392.624988] EXT4-fs (md0): VFS: Can't find ext4 filesystem

# [ 3098.003646] CE: hpet increased min_delta_ns to 773178 nsec

  [ 4208.380943] md: md0: recovery done.
  [ 4208.470356] RAID conf printout:
  [ 4208.470363]  --- level:5 rd:5 wd:5
  [ 4208.470369]  disk 0, o:1, dev:sdd1
  [ 4208.470374]  disk 1, o:1, dev:sde1
  [ 4208.470378]  disk 2, o:1, dev:sdf1
  [ 4208.470382]  disk 3, o:1, dev:sdg1
  [ 4208.470385]  disk 4, o:1, dev:sdh1
  [ 7982.600595] EXT4-fs (md0): VFS: Can't find ext4 filesystem

在启动过程中,它询问我想要做什么。我告诉它继续,并在机器恢复后开始处理它。我做的第一件事是检查/proc/mdstat...

# Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
# md1 : active raid5 sdl1[3] sdk1[2] sdm1[4] sdi1[0] sdj1[1]
#       2930287616 blocks level 5, 128k chunk, algorithm 2 [5/5] [UUUUU]
#       
# md2 : active raid0 sdn[0] sdo[1]
#       1953524992 blocks 64k chunks

  md0 : active raid5 sdf1[2] sdg1[3] sde1[1] sdd1[0] sdh1[5]
        1953531136 blocks super 1.2 level 5, 64k chunk, algorithm 2 [5/5] [UUUUU]
#       
# unused devices: <none>

...和/etc/mdadm/mdadm.conf​​:

  ARRAY /dev/md0 level=raid5 num-devices=5 UUID=98941898:e5652fdb:c82496ec:0ebe2003
# ARRAY /dev/md1 level=raid5 num-devices=5 UUID=67d5a3ed:f2890ea4:004365b1:3a430a78
# ARRAY /dev/md2 level=raid0 num-devices=2 UUID=d1ea9162:cb637b4b:004365b1:3a430a78

然后我检查了fdisk

foundation@foundation:~$ sudo fdisk -l /dev/sd[defgh]

Disk /dev/sdd: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000821e5

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1       60801   488384001   fd  Linux raid autodetect

Disk /dev/sde: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00004a72

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1       60801   488384001   fd  Linux raid autodetect

Disk /dev/sdf: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000443c2

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1               1       60801   488384001   fd  Linux raid autodetect

Disk /dev/sdg: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000e428

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1       60801   488384001   fd  Linux raid autodetect

Disk /dev/sdh: 500.1 GB, 500107862016 bytes
81 heads, 63 sectors/track, 191411 cylinders
Units = cylinders of 5103 * 512 = 2612736 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8c4d0ecf

   Device Boot      Start         End      Blocks   Id  System
/dev/sdh1               1      191412   488385560   fd  Linux raid autodetect

一切似乎都井然有序,所以我检查了阵列的细节并检查了它的组成部分。

foundation@foundation:~$ sudo mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Fri May 13 00:57:15 2011
     Raid Level : raid5
     Array Size : 1953531136 (1863.03 GiB 2000.42 GB)
  Used Dev Size : 488382784 (465.76 GiB 500.10 GB)
   Raid Devices : 5
  Total Devices : 5
    Persistence : Superblock is persistent

    Update Time : Fri May 13 04:43:10 2011
          State : clean
 Active Devices : 5
Working Devices : 5
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 64K

           Name : foundation:0  (local to host foundation)
           UUID : a81ad850:3ce5e5a5:38de6ac7:9699b3dd
         Events : 32

    Number   Major   Minor   RaidDevice State
       0       8       49        0      active sync   /dev/sdd1
       1       8       65        1      active sync   /dev/sde1
       2       8       81        2      active sync   /dev/sdf1
       3       8       97        3      active sync   /dev/sdg1
       5       8      113        4      active sync   /dev/sdh1



foundation@foundation:~$ sudo mdadm --examine /dev/sd[defgh]1

/dev/sdd1: (samsung)
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : a81ad850:3ce5e5a5:38de6ac7:9699b3dd
           Name : foundation:0  (local to host foundation)
  Creation Time : Fri May 13 00:57:15 2011
     Raid Level : raid5
   Raid Devices : 5

 Avail Dev Size : 976765954 (465.76 GiB 500.10 GB)
     Array Size : 3907062272 (1863.03 GiB 2000.42 GB)
  Used Dev Size : 976765568 (465.76 GiB 500.10 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : 6e6422de:f39c618a:2cab1161:b36c8341

    Update Time : Fri May 13 15:53:06 2011
       Checksum : 679bf575 - correct
         Events : 32

         Layout : left-symmetric
     Chunk Size : 64K

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


/dev/sde1: (samsung)
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : a81ad850:3ce5e5a5:38de6ac7:9699b3dd
           Name : foundation:0  (local to host foundation)
  Creation Time : Fri May 13 00:57:15 2011
     Raid Level : raid5
   Raid Devices : 5

 Avail Dev Size : 976765954 (465.76 GiB 500.10 GB)
     Array Size : 3907062272 (1863.03 GiB 2000.42 GB)
  Used Dev Size : 976765568 (465.76 GiB 500.10 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : bd02892c:a346ec88:7ffcf757:c18eee12

    Update Time : Fri May 13 15:53:06 2011
       Checksum : 7cdeb0d5 - correct
         Events : 32

         Layout : left-symmetric
     Chunk Size : 64K

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


/dev/sdf1: (samsung)
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : a81ad850:3ce5e5a5:38de6ac7:9699b3dd
           Name : foundation:0  (local to host foundation)
  Creation Time : Fri May 13 00:57:15 2011
     Raid Level : raid5
   Raid Devices : 5

 Avail Dev Size : 976765954 (465.76 GiB 500.10 GB)
     Array Size : 3907062272 (1863.03 GiB 2000.42 GB)
  Used Dev Size : 976765568 (465.76 GiB 500.10 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : acd3d576:54c09121:0636980e:0a490f59

    Update Time : Fri May 13 15:53:06 2011
       Checksum : 5c91ef46 - correct
         Events : 32

         Layout : left-symmetric
     Chunk Size : 64K

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


/dev/sdg1: (samsung)
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : a81ad850:3ce5e5a5:38de6ac7:9699b3dd
           Name : foundation:0  (local to host foundation)
  Creation Time : Fri May 13 00:57:15 2011
     Raid Level : raid5
   Raid Devices : 5

 Avail Dev Size : 976765954 (465.76 GiB 500.10 GB)
     Array Size : 3907062272 (1863.03 GiB 2000.42 GB)
  Used Dev Size : 976765568 (465.76 GiB 500.10 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : 5f923d06:993ac9f3:a41ffcde:73876130

    Update Time : Fri May 13 15:53:06 2011
       Checksum : 65e75047 - correct
         Events : 32

         Layout : left-symmetric
     Chunk Size : 64K

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


/dev/sdh1:  (western digital)
          Magic : a92b4efc
        Version : 1.2
    Feature Map : 0x0
     Array UUID : a81ad850:3ce5e5a5:38de6ac7:9699b3dd
           Name : foundation:0  (local to host foundation)
  Creation Time : Fri May 13 00:57:15 2011
     Raid Level : raid5
   Raid Devices : 5

 Avail Dev Size : 976769072 (465.76 GiB 500.11 GB)
     Array Size : 3907062272 (1863.03 GiB 2000.42 GB)
  Used Dev Size : 976765568 (465.76 GiB 500.10 GB)
    Data Offset : 2048 sectors
   Super Offset : 8 sectors
          State : clean
    Device UUID : 622c546d:41fe9683:42ecf909:cebcf6a4

    Update Time : Fri May 13 15:53:06 2011
       Checksum : fc5ebc1a - correct
         Events : 32

         Layout : left-symmetric
     Chunk Size : 64K

   Device Role : Active device 4
   Array State : AAAAA ('A' == active, '.' == missing)

我尝试自己安装它:

foundation@foundation:~$ sudo mount -t ext4 -o defaults,rw /dev/md0 mnt
mount: wrong fs type, bad option, bad superblock on /dev/md0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

不行。所以此时我开始尝试做这里和其他地方的各种帖子建议的一些事情。第一件事就是做一个e2fsck

foundation@foundation:~$ sudo e2fsck -f /dev/md0
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/md0

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

由于上述建议与我所读到的内容相呼应,所以我尝试了一下。

foundation@foundation:~$ sudo mke2fs -n /dev/md0
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=16 blocks, Stripe width=64 blocks
122101760 inodes, 488382784 blocks
24419139 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
14905 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848

foundation@foundation:~$ sudo e2fsck -fb 32768 /dev/md0
e2fsck 1.41.14 (22-Dec-2010)
e2fsck: Bad magic number in super-block while trying to open /dev/md0

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

并对每个报告的超级块备份重复此操作。不行啊哈。我还尝试在指向不同部分时安装它,正如一些网站建议的那样……

$ sudo mount -t ext4 -o sb=( (4096 / 1024) * 32768 ),ro /dev/md0 mnt

foundation@foundation:~$ sudo mount -t ext4 -o sb=131072,ro /dev/md0 mnt     
mount: wrong fs type, bad option, bad superblock on /dev/md0,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

这时,我偶然发现了几篇帖子testdisk提到CGSecurity 的 Christophe Grenier然后试了一下。一开始看起来很有希望,但它也找不到任何有用的东西。它甚至看不到任何文件。(虽然photorec看到了,但那时我确实做了“恢复”,结果它在大约 5 分之一的路程处出现了段错误。)

testdisk沮丧之下,我决定深入搜索一番,然后就走了,睡了一会。今天早上,我得到了这个:

TestDisk 6.11, Data Recovery Utility, April 2009
Christophe GRENIER <[email protected]>
http://www.cgsecurity.org

Disk /dev/md0 - 2000 GB / 1863 GiB - CHS 488382784 2 4
        Partition                Start              End        Size in sectors
 1 D Linux                    98212   0  1    73360627   1  4    586099328
 2 D Linux                    98990   0  1    73361405   1  4    586099328
 3 D Linux                    99006   0  1    73361421   1  4    586099328
 4 D Linux                    99057   0  1    73361472   1  4    586099328
 5 D Linux                    99120   0  1    73361535   1  4    586099328
 6 D Linux                182535942   0  1   426669713   1  4   1953070176
 7 D Linux                182536009   0  1   426669780   1  4   1953070176
 8 D Linux                182536470   0  1   426670241   1  4   1953070176
 9 D Linux                182538637   0  1   426672408   1  4   1953070176
10 D Linux                204799120   0  1   326894735   1  4    976764928

Structure: Ok.  Use Up/Down Arrow keys to select partition.
Use Left/Right Arrow keys to CHANGE partition characteristics:
*=Primary bootable  P=Primary  L=Logical  E=Extended  D=Deleted
Keys A: add partition, L: load backup, T: change type, P: list files,
     Enter: to continue

最初几次使用时,testdisk我并没有让它完成完整的搜索,因此我之前从未见过这个更完整的列表。

分区列表左侧的数字是我的,用于识别。应用程序底部是一种描述性消息,当我关注特定分区时,它会发生变化。下面列出了与分区匹配的数字。

1, 2, 3, 4, 5
EXT3 Large file Sparse superblock Recover, 300 GB / 279 GiB

6, 7, 8, 9
EXT4 Large file Sparse superblock Recover, 999 GB / 931 GiB

10
EXT3 Large file Sparse superblock Backup superblock, 500 GB / 465 GiB

即使有更详细的分区列表也无济于事。它无法从列出的分区中读取任何文件。

这就是我现在的处境。我找不到其他的办法。这里的数据很重要,因为它是我未婚夫的摄影驱动器。我知道突袭不是备份,现在很明显,但我认为我买不起可以包含一两个 TB 的备份解决方案。这就是我接下来几天要研究的问题。与此同时,我希望你们能原谅我冗长的文字,并能帮助我找到解决方案。

哦,还有一件事……最后一个分区列表的配置testdisk对我来说似乎非常可疑。一开始是一组五个可能的分区,后面是另一组五个可能的分区。匹配阵列中的设备数量。也许这是一条线索。

答案1

您可能想ddrescue现在看一下是否可以恢复任何东西......

http://www.gnu.org/software/ddrescue/ddrescue.html

答案2

我认为你操之过急,在 fs 完成之前就调整了它的大小。从dmesg输出中你可以看到它必须在你重启后完成重塑:

[    9.542918] md/raid:md0: raid level 5 active with 4 out of 5 devices, algorithm 2 
[    9.543005] md: recovery of RAID array md0
[    9.543007] md: minimum _guaranteed_  speed: 1000 KB/sec/disk.
[    9.543008] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for recovery.
[    9.543013] md: using 128k window, over a total of 488382784 blocks.
[    9.543014] md: resuming recovery of md0 from checkpoint.
[ 4208.380943] md: md0: recovery done.

编辑:数据很可能已经消失了。

相关内容