有没有什么办法可以挂载出现错误的 EXT4 文件系统?

有没有什么办法可以挂载出现错误的 EXT4 文件系统?

我可能有点愚蠢,但一直推迟有关我的 EXT4-on-LVM Ubuntu 机器即将发生故障的警告信号(例如分区重新安装自身 R/O、SMART 错误等),有一天,FSCK 显示“文件系统仍然有错误”......吞咽

我已经购买了替换驱动器,并且已确认仍然可以使用 photorec 查看数据,但我想知道...有没有办法安装 EXT4 卷,即使操作系统知道它已损坏?

瞧,我不需要一切在驱动器上。我基本上想从一个目录中的文本文件中恢复我能恢复的一切。运行 photorec 将(可能)恢复这些文件,但这意味着对恢复的文件运行大量的 grep 来找到一两行文件,然后我可以使用它们来找出我丢失的部分。

非常感谢任何指导!

更新: 从另一台机器上,当我尝试安装驱动器时,我得到:

root@Minilith:~# mount /dev/mapper/xubuntu--vg-root /mnt/
mount: /mnt: mount(2) system call failed: Structure needs cleaning.

对该卷运行 fsck,我得到:

root@Minilith:~# fsck /dev/mapper/xubuntu--vg-root -y
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
ext2fs_check_desc: Corrupt group descriptor: bad block for block bitmap
fsck.ext4: Group descriptors look bad... trying backup blocks...
Block bitmap for group 0 is not in group.  (block 2553887680)
Relocate? yes

Inode table for group 0 is not in group.  (block 3715727360)
WARNING: SEVERE DATA LOSS POSSIBLE.
Relocate? yes

One or more block group descriptor checksums are invalid.  Fix? yes

Group descriptor 0 checksum is 0x11b0, should be 0xaa26.  FIXED.
Block bitmap for group 1792 is not in group.  (block 2553887680)
Relocate? yes

Inode table for group 1792 is not in group.  (block 3682172928)
WARNING: SEVERE DATA LOSS POSSIBLE.
Relocate? yes

Group descriptor 1792 checksum is 0x89a0, should be 0xbabe.  FIXED.
Inode bitmap for group 1793 is not in group.  (block 2097156110)
Relocate? yes

Group descriptor 1793 checksum is 0x5c04, should be 0xd977.  FIXED.
Inode bitmap for group 1795 is not in group.  (block 419506184)
Relocate? yes

Group descriptor 1795 checksum is 0xb484, should be 0x4875.  FIXED.
Inode bitmap for group 1796 is not in group.  (block 2197819406)
Relocate? yes

Group descriptor 1796 checksum is 0x7b44, should be 0x92f0.  FIXED.
Block bitmap for group 1920 is not in group.  (block 2553887680)
Relocate? yes

Inode table for group 1920 is not in group.  (block 3648618496)
WARNING: SEVERE DATA LOSS POSSIBLE.
Relocate? yes

Group descriptor 1920 checksum is 0x2073, should be 0xab14.  FIXED.
Block bitmap for group 4096 is not in group.  (block 2553887680)
Relocate? yes

Inode table for group 4096 is not in group.  (block 4151934976)
WARNING: SEVERE DATA LOSS POSSIBLE.
Relocate? yes

Group descriptor 4096 checksum is 0xc961, should be 0x6ce7.  FIXED.
Block bitmap for group 6016 is not in group.  (block 2553887680)
Relocate? yes

Inode table for group 6016 is not in group.  (block 4000940032)
WARNING: SEVERE DATA LOSS POSSIBLE.
Relocate? yes

Group descriptor 6016 checksum is 0x9648, should be 0x6dd5.  FIXED.
fsck.ext4: e2fsck_read_bitmaps: illegal bitmap block(s) for /dev/mapper/xubuntu--vg-root

/dev/mapper/xubuntu--vg-root: ***** FILESYSTEM WAS MODIFIED *****

/dev/mapper/xubuntu--vg-root: ********** WARNING: Filesystem still has errors **********

更新2:noload,ro按照使用选项“ ”以及单独使用“ ”的建议debug,我得到了以下几行:

root@Minilith:~# mount -o noload,ro /dev/mapper/xubuntu--vg-root /mnt/
mount: /mnt: mount(2) system call failed: Structure needs cleaning.

如果我也加上debug选项,/var/log/syslog我会得到:

Jun 22 13:46:17 Minilith kernel: [145133.789232] EXT4-fs (dm-3): ext4_check_descriptors: Block bitmap for group 0 not in group (block 2553887680)!
Jun 22 13:46:17 Minilith kernel: [145133.789242] EXT4-fs (dm-3): group descriptors corrupted!

答案1

您可以使用“noload”挂载选项来挂载标记为“脏”的 ext3/4 文件系统,但它将处于只读模式。

mount -t ext4 -o noload,ro /dev/mapper/xubuntu--vg-root /mnt/

至少应该让你安装驱动器。

相关内容