在超级块中发现 ext4 损坏,但可以安装文件系统

在超级块中发现 ext4 损坏,但可以安装文件系统

崩溃后,我的 Ext4 文件系统(在 LVM LV 上)在运行时出现以下错误fsck.ext4 -nf

e2fsck 1.42.12 (29-Aug-2014)
Corruption found in superblock.  (blocks_count = 0).

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
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>
 or
    e2fsck -b 32768 <device>

我已经跑去dumpe2fs寻找超级块的其他副本,但无论我在fsck.ext4s -b选项后添加哪一个,我都会得到完全相同的输出。

此外,还dumpe2fs可以看到正确的块计数(Block count: 429496729616TB 文件系统)。这是(截断的)输出:

Filesystem volume name:   <none>
Last mounted on:          /storage
Filesystem UUID:          fef00ffc-5341-4158-9279-88cad6cc211f
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              268435456
Block count:              4294967296
Reserved block count:     42949672
Free blocks:              534754162
Free inodes:              268391425
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         2048
Inode blocks per group:   128
Flex block group size:    16
Filesystem created:       Wed Jan 16 11:07:07 2013
Last mount time:          Sun Feb  1 21:21:31 2015
Last write time:          Sun Feb  1 21:21:45 2015
Mount count:              18
Maximum mount count:      -1
Last checked:             Wed Jan 16 11:07:07 2013
Check interval:           0 (<none>)
Lifetime writes:          14 TB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      c7ec9ee0-002b-431d-a37c-33db922c6057
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke journal_64bit
Journal size:             128M
Journal length:           32768
Journal sequence:         0x0000e3fe
Journal start:            0

Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
  Checksum 0x4623, unused inodes 2034
  Primary superblock at 0, Group descriptors at 1-2048
  Block bitmap at 2049 (+2049), Inode bitmap at 2065 (+2065)
  Inode table at 2081-2208 (+2081)
  28637 free blocks, 2036 free inodes, 1 directories, 2034 unused inodes
  Free blocks: 4130-4133, 4135-32767
  Free inodes: 11, 14-2048
Group 1: (Blocks 32768-65535) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xfd95, unused inodes 2048
  Backup superblock at 32768, Group descriptors at 32769-34816
  Block bitmap at 2050 (bg #0 + 2050), Inode bitmap at 2066 (bg #0 + 2066)
  Inode table at 2209-2336 (bg #0 + 2209)
  1522 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 34817, 35343-36863
  Free inodes: 2049-4096
Group 2: (Blocks 65536-98303) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x95d0, unused inodes 2048
  Block bitmap at 2051 (bg #0 + 2051), Inode bitmap at 2067 (bg #0 + 2067)
  Inode table at 2337-2464 (bg #0 + 2337)
  115 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 85901-86015
  Free inodes: 4097-6144
Group 3: (Blocks 98304-131071) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x6e40, unused inodes 2048
  Backup superblock at 98304, Group descriptors at 98305-100352
  Block bitmap at 2052 (bg #0 + 2052), Inode bitmap at 2068 (bg #0 + 2068)
  Inode table at 2465-2592 (bg #0 + 2465)
  1505 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 100895-102399
  Free inodes: 6145-8192
Group 4: (Blocks 131072-163839) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x4788, unused inodes 2048
  Block bitmap at 2053 (bg #0 + 2053), Inode bitmap at 2069 (bg #0 + 2069)
  Inode table at 2593-2720 (bg #0 + 2593)
  1808 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 141552-143359
  Free inodes: 8193-10240
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x0d39, unused inodes 2048
  Backup superblock at 163840, Group descriptors at 163841-165888
  Block bitmap at 2054 (bg #0 + 2054), Inode bitmap at 2070 (bg #0 + 2070)
  Inode table at 2721-2848 (bg #0 + 2721)
  2023 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 165913-167935
  Free inodes: 10241-12288
Group 6: (Blocks 196608-229375) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xc119, unused inodes 2048
  Block bitmap at 2055 (bg #0 + 2055), Inode bitmap at 2071 (bg #0 + 2071)
  Inode table at 2849-2976 (bg #0 + 2849)
  1755 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 198541-198655, 223640-225279
  Free inodes: 12289-14336
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0xf858, unused inodes 2048
  Backup superblock at 229376, Group descriptors at 229377-231424
  Block bitmap at 2056 (bg #0 + 2056), Inode bitmap at 2072 (bg #0 + 2072)
  Inode table at 2977-3104 (bg #0 + 2977)
  1796 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 231676-233471
  Free inodes: 14337-16384
Group 8: (Blocks 262144-294911) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x6a75, unused inodes 2048
  Block bitmap at 2057 (bg #0 + 2057), Inode bitmap at 2073 (bg #0 + 2073)
  Inode table at 3105-3232 (bg #0 + 3105)
  1700 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 278876-280575
  Free inodes: 16385-18432
Group 9: (Blocks 294912-327679) [INODE_UNINIT, ITABLE_ZEROED]
  Checksum 0x3840, unused inodes 2048
  Backup superblock at 294912, Group descriptors at 294913-296960
  Block bitmap at 2058 (bg #0 + 2058), Inode bitmap at 2074 (bg #0 + 2074)
  Inode table at 3233-3360 (bg #0 + 3233)
  1986 free blocks, 2048 free inodes, 0 directories, 2048 unused inodes
  Free blocks: 297022-299007
  Free inodes: 18433-20480

... truncated ...

奇怪的是,我可以挂载文件系统而没有任何(明显的)问题(尽管我还不敢写入它)。

对于允许我完成 fsck 的解决方案有任何建议/指针/想法吗?

答案1

你的设备正好有 4294967296 个块,即 2 32,所以这听起来像是一个可变大小的问题......如果你运行的是 32 位 e2fsck,这可以解释错误消息;您看到的错误来自e2fsck/super.c

check_super_value(ctx, "blocks_count", ext2fs_blocks_count(sb),
                  MIN_CHECK, 1, 0);

其中check_super_value()定义为

static void check_super_value(e2fsck_t ctx, const char *descr,
                              unsigned long value, int flags,
                              unsigned long min_val, unsigned long max_val)

unsigned long因此,在4 个字节的32 位系统上,您的blocks_countwill 最终为 0,并且无法通过最小值检查,而不会表明文件系统存在实际问题。

之所以只在崩溃后才会看到此情况,是因为它fsck仅在崩溃后或文件系统太长时间未检查时运行。

你的问题的答案是,如果你运行 32 位e2fsck,尝试 64 位版本...

答案2

我尝试在全新的 3TB 驱动器上创建新卷时遇到此问题。答案是创建 2 个分区,构建一个良好的超级块,然后调整大小以获得最大大小的单个分区。射线

相关内容