修复/恢复 JFS 超级块(或从损坏的文件系统中恢复数据)

修复/恢复 JFS 超级块(或从损坏的文件系统中恢复数据)

前言:

由于这是一个关于数据恢复的问题,我预计在“你的备份在哪里?”这一行中会有很多“非答案”。或“在块级图像副本上执行此操作”。谢谢,我知道了,你不用再教我了。请参阅末尾的注释了解内容和原因。谢谢。


我的 JFS 文件系统映像已损坏。jfs_fsck拒绝对其进行处理,并显示以下错误消息:

~ % sudo jfs_fsck /dev/loop0
jfs_fsck version 1.1.15, 04-Mar-2011
processing started: 3/1/2017 13:08:53
Using default parameter: -p
The current device is:  /dev/loop0
Superblock is corrupt and cannot be repaired 
since both primary and secondary copies are corrupt.  

 CANNOT CONTINUE.

使用jfs_debugfs命令sus2p获得以下信息:

~ % sudo  jfs_debug /dev/loop0
jfs_debugfs version 1.1.15, 04-Mar-2011

Aggregate Block Size: 4096

输出su p

[1] s_magic:            'JFS1'          [15] s_ait2.addr1:      0x00
[2] s_version:          1               [16] s_ait2.addr2:      0x0000e92f
[3] s_size:     0x000000015d4d4ec0           s_ait2.address:    59695
[4] s_bsize:            4096            [17] s_logdev:          0x00000900
[5] s_l2bsize:          12              [18] s_logserial:       0x0009afb1
[6] s_l2bfactor:        3               [19] s_logpxd.len:      8192
[7] s_pbsize:           512             [20] s_logpxd.addr1:    0x00
[8] s_l2pbsize:         9               [21] s_logpxd.addr2:    0x2baa0160
[9] pad:                Not Displayed        s_logpxd.address:  732561760
[10] s_agsize:          0x00800000      [22] s_fsckpxd.len:     22408
[11] s_flag:            0x10200900      [23] s_fsckpxd.addr1:   0x00
                        JFS_LINUX       [24] s_fsckpxd.addr2:   0x2ba9a9d8
        JFS_COMMIT      JFS_GROUPCOMMIT      s_fsckpxd.address: 732539352
                        JFS_INLINELOG   [25] s_time.tv_sec:     0x4902c28b
                                        [26] s_time.tv_nsec:    0x00000000
                                        [27] s_fpack:           'thor_storag'
[12] s_state:           0x00000001
             FM_MOUNT
[13] s_compress:        0
[14] s_ait2.len:        4

输出su s

[1] s_magic:            '    '          [15] s_ait2.addr1:      0x00
[2] s_version:          0               [16] s_ait2.addr2:      0x00000000
[3] s_size:     0x0000000000000000           s_ait2.address:    0
[4] s_bsize:            0               [17] s_logdev:          0x00000000
[5] s_l2bsize:          0               [18] s_logserial:       0x00000000
[6] s_l2bfactor:        0               [19] s_logpxd.len:      0
[7] s_pbsize:           0               [20] s_logpxd.addr1:    0x00
[8] s_l2pbsize:         0               [21] s_logpxd.addr2:    0x00000000
[9] pad:                Not Displayed        s_logpxd.address:  0
[10] s_agsize:          0x00000000      [22] s_fsckpxd.len:     0
[11] s_flag:            0x00000000      [23] s_fsckpxd.addr1:   0x00
                                        [24] s_fsckpxd.addr2:   0x00000000
                                             s_fsckpxd.address: 0
                                        [25] s_time.tv_sec:     0x00000000
                                        [26] s_time.tv_nsec:    0x00000000
                                        [27] s_fpack:           ''
[12] s_state:           0x00000000
             FM_CLEAN
[13] s_compress:        0
[14] s_ait2.len:        0

输出s2p p

[1] s_magic:            'JFS1'          [16] s_aim2.len:        2
[2] s_version:          1               [17] s_aim2.addr1:      0x00
[3] s_size:     0x000000015d4d4ec0      [18] s_aim2.addr2:      0x0000e92d
[4] s_bsize:            4096                 s_aim2.address:    59693
[5] s_l2bsize:          12              [19] s_logdev:          0x00000900
[6] s_l2bfactor:        3               [20] s_logserial:       0x0009afb1
[7] s_pbsize:           512             [21] s_logpxd.len:      8192
[8] s_l2pbsize:         9               [22] s_logpxd.addr1:    0x00
[9]  s_agsize:          0x00800000      [23] s_logpxd.addr2:    0x2baa0160
[10] s_flag:            0x10200900           s_logpxd.address:  732561760
             LINUX                      [24] s_fsckpxd.len:     22408
    GROUPCOMMIT                         [25] s_fsckpxd.addr1:   0x00
                INLINELOG               [26] s_fsckpxd.addr2:   0x2ba9a9d8
                                             s_fsckpxd.address: 732539352
[11] s_state:           0x00000001      [27] s_fsckloglen:      50
                MOUNT                   [28] s_fscklog:         2
[12] s_compress:        0               [29] s_fpack:           'thor_storagة�+'
[13] s_ait2.len:        4
[14] s_ait2.addr1:      0x00
[15] s_ait2.addr2:      0x0000e92f
     s_ait2.address:    59695

输出s2p s

[1] s_magic:            '    '          [16] s_aim2.len:        0
[2] s_version:          0               [17] s_aim2.addr1:      0x00
[3] s_size:     0x0000000000000000      [18] s_aim2.addr2:      0x00000000
[4] s_bsize:            0                    s_aim2.address:    0
[5] s_l2bsize:          0               [19] s_logdev:          0x00000000
[6] s_l2bfactor:        0               [20] s_logserial:       0x00000000
[7] s_pbsize:           0               [21] s_logpxd.len:      0
[8] s_l2pbsize:         0               [22] s_logpxd.addr1:    0x00
[9]  s_agsize:          0x00000000      [23] s_logpxd.addr2:    0x00000000
[10] s_flag:            0x00000000           s_logpxd.address:  0
                                        [24] s_fsckpxd.len:     0
                                        [25] s_fsckpxd.addr1:   0x00
                                        [26] s_fsckpxd.addr2:   0x00000000
                                             s_fsckpxd.address: 0
[11] s_state:           0x00000000      [27] s_fsckloglen:      0
                CLEAN                   [28] s_fscklog:         0
[12] s_compress:        0               [29] s_fpack:           '        '
[13] s_ait2.len:        0
[14] s_ait2.addr1:      0x00
[15] s_ait2.addr2:      0x00000000
     s_ait2.address:    0

现在的问题是,我必须在超级块中操纵哪些值,以便jfs_fsck可以说服我去工作,或者我可以挂载它(使用 Linux jfs 内核文件系统实现)?

如果有一些工具可以仔细检查文件系统映像并吐出它认为是其中文件的所有内容,那也是完全可以接受的。


尾注

由于一些事件在我的控制之下,带有 JFS 文件系统的 Linux mdadm RAID-5 在某种程度上被损坏了,直到今天我仍然不明白哪种故障模式。这个 FS 是我与另一个人共享的 NAS 的一部分,我反复提醒他,RAID 不会取代备份,但尽管有这些警告,其他人在该 RAID 上仍然有一些未备份的数据(现在正处于半生气的阶段……我对我有这样的印象)。我们立即采取的行动是从系统中删除磁盘并创建它们的块级副本。我要做的任何操纵都发生在快照这些副本,所以无论恢复过程中发生什么问题,我都可以随时回滚。

昨天我终于能够将 mdadm RAID 恢复到(希望一致)状态。

基本上我想恢复那里的东西,然后就到此为止了。

相关内容