Skip to content

Did you know?

A damaged ext4 superblock can be repaired from a backup copy with e2fsck -b.

mkfs.ext4 -n lists backup superblocks; e2fsck -b 32768 repairs from one.

Explained

When an ext4 partition refuses to mount with “bad superblock” and e2fsck says Bad magic number in super-block, the data is usually still there: ext4 keeps several backup copies of the superblock. List their locations with a dry run that writes nothing:

sudo mkfs.ext4 -n /dev/sdb1

Then repair from the first backup, usually block 32768 on filesystems with 4k blocks:

sudo e2fsck -fy -b 32768 /dev/sdb1

In our test on e2fsprogs 1.47.2, a filesystem with a wiped primary superblock mounted again with its files intact. Double-check the -n: without it, mkfs.ext4 formats the partition.

Learn more

← All tech tips · Suggest a fix

Back to top