e2fsck complains that either super block or partition table is corrupt, why ?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 3
  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7

Issue

  • While doing a file system check using 'e2fsck', it complains as follows :
bash-3.2# e2fsck /dev/mapper/vg_name-lv_name
e2fsck 1.39 (29-May-2006)
The filesystem size (according to the superblock) is 66584576 blocks
The physical size of the device is 65798144 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? yes
  • The size of the file system does not match the size of the device.

  • e2fsck fails to read block numbers after the specific size and aborts.

Pass 1: Checking inodes, blocks, and sizes
Error reading block <block-number> (Invalid argument) while getting next inode from scan. Ignore error? no

Error while scanning inodes <inode-number>: Can't read next inode
e2fsck: aborted

Resolution

  • Check the current size of the file system and the device size.

  • Resize the file system size to the size of the actual device size.

# umount <file-system>

# resize2fs <device-name>

NOTE: Ensure that a valid file system backup is available as a file system corruption might have already happened or resize2fs might cause file system corruption

Root Cause

  • An improper or incomplete file system or device resizing can leave the file system superblock corrupted. If the superblock is not updated with the current size of the file system, it would report a wrong size of the file system whereas the actual device is different.

  • Or in some cases, it has been observed that the partition table is corrupt. The problem in such cases are since a file system does not keep any backups for a partition table like a superblock backup, it is very hard to restore the partition to the previous state.

  • It can be restored if the exact cylinder/sector geometry of the previous/existing partition is known. The trick is to do a partition using parted or fdisk maintaining the same cylinder limits. But that is in most cases not possible. In such a situation, mount the partition and do a data backup as soon as possible. After this, repartition the device if possible and copy over the data.

Diagnostic Steps

  • Identify the current file system size
# dumpe2fs <file-system> |grep "Block count"
  • Check the size of the underlying device.
# lvs -ao +devices
  • Check if there was any resizing of file system or the device was done before the issue occurred.
The filesystem size (according to the superblock) is 126220288 blocks
The physical size of the device is 124909568 blocks

The filesystem size:
126220288 * 4096 = 481.49 GB

The physical size:
124909568 * 4096 = 476.49 GB

The PV is 5GB short, or the filesystem is 5GB too large.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

7 Comments

no resolution given step by step.. here

Hello,

Didn't the steps in the solution help you? You would need to understand the current filesystem size as well as the underlying block size of the disk. For that, the block numbers multiplied by the block size (from 'dumpe2fs' output), and the lvs output would help. Do you want to see the full steps on how to do this added to the article?

Vimal

i followed these steps but no success..again and again received same error..

ok if The PV is 5GB short, or the filesystem is 5GB too large then there should be steps how to reduce or increaes pv in rescue mode.. thnx.

Hello,

If you have a subscription with Red Hat, would it be possible to open a case so that we can investigate this further. Else, you can always ask the question in the 'Groups' section, were we have lots of experts looking at the queries.

Please be specific on the steps you've followed, as well as the errors/messages you get after each command, what you see after following all the steps etc.. This will be of considerable help.

Thank you,

Vimal

i have subscription and opened case no solution provided yet..

Hello,

Did you get a resolution for the case you've opened?

Thank you,