If fsck or mount commands give errors then pretty good chances are there that the superblock is corrupt. The dd command comes to rescue. We know that the superblock resides in 31st block also. So, to recover that we use the following command:
# dd count=1 bs=4k skip=31 seek=1 if=/dev/my_lv of=/dev/my_lv
count: How many blocks to copy.
bs: Block size(which is taken 4k by default).
skip: Skip number ofÂ blocks.
seek: Get 1st record.
So, the above command will copy the 31st block to the 1st block.
Running fsck command is recommended after restoring the superblock.
Recovering Superblock In Linux
In case of Linux, the superblock is copied to 8193, 32768, 98304, 163840, 229376 and 294912 blocks. So, simply running:
#e2fsck -b 32768 /dev/hda5
Should do the trick. Superblock is started to be backed up at 32768 position in the most current systems. So, 32768 is safe option for almost all systems.
1 thought on “How To Recover A Superblock”
your IF and OF are the same, how will that backup any data that is there?
Shouldn’t the OF be a place on your hard drive instead of the mount point you are copying from?
Or am I missing something…