Recovering Corrupt ext3 Superblocks

Fixing an ext3 partition that has corrupt superblocks and won't mount because the kernel thinks its ext4.

Yesterday, my USB ext3 500GB disk complained that it could not write any files because it was full. I deleted a few files, then had a look at df -h, which claimed i was using 16TB of a 16TB drive. I unmounted the drive, and then replugged it in. This time it did not auto-mount.

It turns out that some of the superblocks had become corrupted. fsck wouldn't run because it couldn't read the superblock. No worries, I thought. I'll just use dumpe2fs to tell me where the backup superblocks are and pass one of these as an argument with -b to e2fsck to force it to use one that was still intact. Only dumpe2fs failed with an error that I forgot to make a note of. Also, gparted claimed that the partition was ext4.

In the end I ran mkfs.ext3 -n /dev/sdb1. -n only displays what would be done if the disk was formatted, but does not actually format. One of the things it does display though, is the deterministic locations of where it would create the superblocks for a partition this size. Armed with this information, I could then try them one in turn with the -b switch on e2fsck until I stumbled across one that was intact. fsck found an awful lot of errors (probably because the disk was heavily in use when the problem occured), but I seem to have the majority of my data intact.

The moral of the story is to always have backups! You may not be as lucky as me.

Posted 26th June 2009 in Computer, with 2 comments

Digg!

comments

  1. Michael

    Backups of a 16TB volume? That's quite a lot of external hard drives...

  2. Albert Druehe

    I plugged an external SATA(ext3) via USB to a new installed UBUNTU 10.04 - PC. Now the partition is corrupt. You only run "mkfs.ext3 -n /dev/sdb1", and your files were readable? Did I understand that right? dumpe2fs failed and is no use?


  3. (optional)