SDB:Clean the swap superblock

Jump to: navigation, search

Upon booting your system halts and you get an error similar to:

"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>"

This article will help you determine the real problem and fix it.

At this time, insert a live CD with some basic utilities like: fdisk, e2fsk, some editor and shutdown and reboot your system.

login as root.

You need to determine if you really have a problem with your filesystem records, a physical problem with your discs, or an uncleared swap file.

BEFORE YOU START - unmount the discs you will work on or you'll ruin it.

First, from a konsole, do "fdisk -l" to get a list the partitions you have with their names i.e., /dev/sda3 /. Keep the list handy by just opening other konsoles.

Second, from a konsole, do "dumpe2fs /dev/sda3" to list the alternate superblocks you may have.

Now you can try this command for each superblock until you are either successful or exhaust your choices "e2fsk -b (the block number you are trying) /dev/sda3

If you did not get a list of block numbers, dont' panic - it may very well mean you do not really have a problem with a superblock.

Third, from a konsole type "e2fsck -c -f -v /dev/sda3" for each ext2/3/4 partition you have. This will forcibly check your filesystem and make a report of any errors that are found and fix the easy ones and prompt you with hard ones. It works very well.

IF NO ERRORs were found, you may not have a problem with the filesystem for these partitions at all.

Fourth, Now, at this point, you have either fixed a bad superblock, or a bad filesystem table. BUT... if these were not problematic, then you may have a swap partition that was not cleaned upon shutdown.

To fix or clear a swap partition, do these two commands from a konsole in order:

(a) "swapoff -a /dev/sda2" (b) "mkswap /dev/sda2 -L swap"

Then shutdown the live CD and start back in your regular system.

SEE ALSO: http://old-en.opensuse.org/Disk_repair_alternate_superblocks