Bad Superblock

From Noah.org
Revision as of 08:14, 4 August 2010 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The `e2fsck` command will not repair a partition if the primary superblock at block 0 is corrupt. Luckily, ext2 and ext3 maintain backups of the superblock throughout the disk. Unfortunately, `e2fsck` will not locate and use a backup superblock for you. You have to locate and specify the location of a backup superblock manually. I'm not sure why `e2fsck` doesn't have an option to do this for you. If you specify a valid backup superblock for `e2fsck` to use then it will also fix the primary superblock at block 0.

Locate backup superblocks:

dumpe2fs /dev/sdb1 | grep -i superblock

Or use `mke2fs`:

mke2fs -n /dev/sdb1

You should get a list like this (much longer in the real world):

  Primary superblock at 0, Group descriptors at 1-10
  Backup superblock at 32768, Group descriptors at 32769-32778
  Backup superblock at 98304, Group descriptors at 98305-98314

Now you can tell `e2fsk` where to find a backup superblock:

e2fsck -f -b 32768 /dev/sdb1