Recovering from a corrupt superblock on an ext3 filesystem

I had a disk which suffered some corruption recently. It’s a shame that for my recent writing of the benefits of ext3 I should suffer from some ext3 filesystem corruption. Still, it was better than with xfs which I could not ever repair due to the size of the filesystem and/or the fact that the server was 32-bit. Here’s the steps I took.

Really you should make a backup before doing these sorts of repairs but this was a 500GB filesystem and I didn’t have that much spare space. The data involved was also not critical. I started first with just trying to run fsck on the unmounting filesystem:

fsck.ext3 /dev/mapper/data

e2fsck 1.40-WIP (14-Nov-2006)
fsck.ext3: Filesystem revision too high while trying to open /dev/mapper/data
The filesystem revision is apparently too high for this version of e2fsck.
(Or the filesystem superblock is corrupt)

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

Next I set the alternative superblock (which apparently is at 32768 for a filesystem with 4k pages). I also used “-C 0” to enable a progress bar and “-y” to automatically fix things.

e2fsck -C 0 -b 32768 -y /dev/mapper/data

Creative Commons License Except where otherwise noted, content on this site is licensed under a Creative Commons by-nc-sa 3.0 License