DAMAGED SUPERBLOCK
If a filesystem check fails and returns the error message “Damaged Superblock” you're lost . . . . . . . or not ?
Well, not really, the damaged ¨superblock¨ can be restored from a backup. There are several backups stored on the harddisk. But let me first have a go at explaining what a “superblock”is.
A superblock is located at position 0 of every partition, contains vital information about the filesystem and is needed at a fielsystem check.
The information stored in the superblock are about what sort of fiesystem is used, the I-Node counts, block counts, free blocks and I-Nodes, the numer of times the filesystem was mounted, date of the last filesystem check and the first I-Node where / is located.
Thus, a damaged superblock means that the filesystem check will fail.
Our luck is that there are backups of the superblock located on several positions and we can restore them with a simple command.
The usual ( and only ) positions are: 8193, 32768, 98304, 163840, 229376 and 294912. ( 8193 in many cases only on older systems, 32768 is the most current position for the first backup )
You can check this out and have a lot more info about a particular partition you have on your HD by:
CODE |
$ dumpe2fs /dev/hda5 |
( go on, try it right now ! )
You will see that the primary superblock is located at position 0, and the first backup on position 32768.
O.K. let´s get serious now, suppose you get a ¨Damaged Superblock¨ error message at filesystem check ( after a power failure ) and you get a root-prompt in a recovery console, then you give the command:
CODE |
# e2fsck -b 32768 /dev/hda5 |
( don´t try this at home . . uh, I mean: don´t try this on a mounted filesystem )
It will then check the filesystem with the information stored in that backup superblock and if the check was successful it will restore the backup to position 0.
Now imagine the backup at position 32768 was damaged too . . . then you just try again with the backup stored at position 98304, and 163840, and 229376 etc. etc. until you find an undamaged backup ( there are five backups so if at least one of those five is okay it´s bingo ! )
So next time don´t panic . . just get the paper where you printed out this Tip and give the magic command
CODE |
# e2fsck -b 32768 /dev/hda5 |

Bruno
-- Aug 12 2003 ( Revised Dec 12 2005 ) --