Mount failing: bad superblock error message

Q I tried to mount one of my extra disks the other day and got the following error message:

mount: wrong fs type, bad option, bad superblock on /dev/hda1, or too many mounted file systems

When I tried to scan the disk with fsck I got this message:

fsck.ext3: No such file or directory while trying to open /dev/hda1

The superblock could not be read or does not describe a correct ext2 filesystem. I'm going to replace the disk but would like to recover the data. Is there any way to do it?

A Luckily, yes! The ext2 and ext3 filesystems have backup superblocks stored at regular intervals throughout the disk, you simply need to find out where they are and specify them to fsck when you repair the filesystem. Their position depends on the size of the partition created. The easiest way to locate them is to rerun mke2fs specifying the -n switch. This will cause mke2fs to do nothing but tell you what it would do.

mke2fs /dev/hda

The info that this code gives you will include a list of locations that superblocks are stored at throughout the filesystem. Using that info you can instruct fsck to repair the filesystem using one of the backup superblocks.

fsck -b 8193 /dev/hda

where 8193 is the backup superblock you observed from the previous command. Once repaired you should be able to mount the filesystem as usual.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar