fsck.ext3: Bad magic number in super-block

So, every so often after upgrading my Ubuntu server, I occasionally get an error during boot, saying the following:

fsck.ext3: Superblock invalid, trying backup blocks…

fsck.ext3: Bad magic number in super-block while trying to open /dev/sdc1

fsck died with exit code 8

After some rooting around, it turns out to be an error on my part. It is all down to my /etc/fstab file (a text file which tells Ubuntu how and where to mount all the hard drives in your system). A while ago, Ubuntu changed the way it records drives details, whereas it use to use /dev/sdX to refer to a drive (with X being a-z) it now uses UUIDs instead. These are unique ID numbers that the system gives to a drive. It changed from /dev/sdX to UUID since occasionally the sdX number would change upon a reboot.

This was exactly what was happening to me. In my fstab file I used /dev/sdc1 to refer to one USB hard drive, and a UUID to refer to another. fstab correctly mounted the UUID drive, but the /dev/sdc1 had changed from the original USB drive it referred to, to the same USB drive that I mounted via the UUID number, thus it failed to mount. When fsck (Ubuntu’s file checking program) runs, it uses fstab to find out info about the hard drives you have. If you have a situation like mine where two entries where referring to the same hard drive, fsck freaks out and dies, thus the error.

To fix this, you need to edit your fstab. Now, if you are lucky, you can simply type EXIT at the prompt you get when this error occurs and the system will boot up. If not, I’d recommend using an Ubuntu LiveCD to boot up the system and then edit your fstab file.

So, open /etc/fstab in a text editor, make sure you use a user with the correct privileges to do this. Then, open a command prompt and type

sudo fdisk -l

This will list all your hard drives, allowing you to identify them. Next, type:

sudo blkid

This will list all your hard drives and their UUID numbers.

Using the info from the first command, fdisk and the UUID number from the second command, blkid, you can work out which device has which UUID number. Then make sure in your /etc/fstab file, you refer to devices using UUID=XXXXXXXXXXXXXXX instead of /dev/sdXX.

This way, your disks will always mount correctly and you shouldn’t get anymore fsck errors on boot, well until your hard drive dies lol!

2 thoughts on “fsck.ext3: Bad magic number in super-block

  1. Thank you for being an early adopter.
    You saved my day, thinking my drives was all broken.

  2. Hey, no problems, I just try and post the info I find out, hoping it is useful šŸ˜‰ Glad I could help someone out. I must admit, when Ubuntu throws that error, it is a little bit scary, makes you think the whole system has died, when really it is just one little text file!

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.