How Do I Fix a "Bad magic number in super-block" error?
I've recently run into an issue where my Linode is unable to boot. When I looked at the console, I found this error message:
Bad magic number in super-block while trying to open /dev/sda
I've tried rebooting but that doesn't work. How can I fix this?
You'll want to follow the steps below to fix the Bad magic number in super-block error on your Linode. This guide is written for when when the error is in reference to
/dev/sda disk, if you're seeing this error for another disk you'll want to swap out
/dev/sda with the disk mentioned in the commands below.
Reboot your Linode into Rescue Mode
mke2fs -n /dev/sdato find the disks Superblocks backups. Your output should look similar to what's below.
mke2fs 1.45.6 (20-Mar-2020) Creating filesystem with 12976128 4k blocks and 3244032 inodes Filesystem UUID: 2500590e-c494-4e0b-ab27-2e000a1fb6d9 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424
fsck -b $BACKUPSB /dev/sdato repair your disk using the Superblock backup. As an example, for the output above you'll want to run
fsck -b 32768 /dev/sdawhich uses the first backup block. Enter
yto proceed with fixing the errors.
- Mount the disk with
mount -o barrier=0 /dev/sda /media/sdato confirm the disk has been repaired and can now be mounted.
If your disk successfully mounts, you should be able to reboot your Linode normally and be good to go.