1

I have an ext3 disk from my NAS. I took this drive out of the NAS and mounted it under my Debian Wheezy system.

When I ran fsck it told me that the superblock was bad. I don't haver a full log, but the exact error message was fsck.ext3: Bad magic number in super-block while trying to open So, after reading up a little I attempted to restore the superblock from backup using the command:

sudo e2fsck -b 32768 /dev/sda2

After rebooting it appears that the drive is empty, and all of my folders are gone! What's more - my drive was originally in ext3 format but now it is detected as ext2. Is there an ext3 specific way to restore the superblock?

What is the best way to restore this drive's previous partition table / directory structure without risking making it worse?

2
  • 3
    A good start, if you have spare disk space, would be to dd the entire drive's content elsewhere. For example, dd if=/dev/sdb of=~/sdb.copy bs=1M That way, even if you do mess up further, you can at least get back to what you have now. The data is almost certainly still there.
    – user
    Commented Jun 15, 2015 at 12:45
  • 1
    Did you mean 1TB? because it doesn't sound like a problem to back up 1GB of data. Commented Jun 15, 2015 at 12:47

2 Answers 2

1

Offset 32768 is where the backup copy of the superblock is on EXT filesystems with 4K clusters. Are you sure this is the right cluster size in your case? Usually it's 1K, and to restore the superblock you need to read offset 8193:

sudo e2fsck -b 8193 /dev/sda2

PS. It's too late now, but I'll still say it here: make back-ups before you mess with file systems. Saving the first MB of your disk would take you 1 second, and being able to restore it would save you a lot of frustration as you go.

4
  • Offset 32768 was the first one was identified in the list output from mke2fs. When you say it's too late now, I presume you mean to restore with a different block size.. what would you do if you wanted to get the files/folders off the drive?
    – Black
    Commented Jun 15, 2015 at 13:24
  • No, I meant to save the first 1MB of data from the raw device (/dev/sda2) to be able to come back to the initial state (even if it was corrupt already). Anyway, you have already overwritten your superblock, so I guess you won't be at loss if you try the command for 1K block filesystem and see if it helps. Commented Jun 15, 2015 at 13:32
  • when I try to run fsck.ext3 -b 8193 /dev/sda2 I get a message that the superblock could not be read or does not describe a correct ext2 filesystem - now I'm really confused - why is it asking about ext2 when I'm using an ext3 tool on an ext3 drive?
    – Black
    Commented Jun 15, 2015 at 23:38
  • I don't know what else to suggest. In this topic someone with a similar issue was unable to recover the superblock and ultimately had to recover individual files. Commented Jun 16, 2015 at 8:45
0

I think the reason for the initial problem was that perhaps I inadvertently somehow overwrote the filesystem in Ext2 format. I was unable to restore the superblock, but it wasn't too much of an issue in the end as I was able to recover all my files using Testdisk, and then simply reformat the drive and put the files back.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .