I recently had a partition crash which was caused by a bad superblock. Google was unable to find a good fix procedure for me so I'm posting this to help out the next poor sap who gets hit with this.
First indication is that the partition won't mount:
Desktop:/home/crashedagain# mount /dev/hda8 /media/hda8
mount: wrong fs type, bad option, bad superblock on /dev/hda8,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
dmesg tail will give some info that will end in:
couldn't mount because of unsupported optional features (2000200)
So then try e2fsck <dev> which gives a "try alternate superblock" message:
e2fsck: Filesystem revision too high while trying to open /dev/hda8
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 <device>
8193 is just an example & probably won't work so find out where the alternate superblocks are with "mke2fs -n <dev> :
Desktop:/home/crashedagain# mke2fs -n /dev/hda8
mke2fs 1.40.2 (12-Jul-2007)
warning: 318 blocks unused.
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
623808 inodes, 1245184 blocks
62275 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1275068416
38 block groups
32768 blocks per group, 32768 fragments per group
16416 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Then try the alternate superblock, keep trying until you (hopefully) get one that works:
e2fsck -b 98304 /dev/hdb5
Once the filesystem is restored to the point of being mountable, try to fix it:
e2fsck -c /dev/hda5
-c checks for bad blocks. It took a while & needed a bunch of interaction. I just agreed "yes" to everything it wanted to do. It would not allow to use the "-p" option & proceed without asking.
Eventually it restored at least 99% of everything but left some odd changes...for instance some of my kde config files were set to user 488 instead of user crashedagain (there is no user 488). Some mail messages and some desktop settings were trashed but most recovery was OK.
I was pretty worried for a while, though. I hope this helps somebody...actually I guess I hope it is never needed but that's probably too optomistic.