I accidentally used dd and wrote over the first 208MB of my external disk. What I wrote over is a partition on its own (Debian nestinstaller) so what I see now is not my old (now damaged) ext4 partition but another smaller partition. This limits the tools and advices I could follow.
My plan was to recreate the partition table with testdisk and then fix everything with the backup superblocks as described here. I'd lose the first 208MB but that's ok compared to the other 300GB of data in there. Something like the following:
mke2fs -n /dev/sdb1 # doesn't work because sdb1 is the 208MB new partition
testdisk ... # used this to create new correct partition table
mke2fs -n /dev/sdb1 # now works fine, get backup superblock positions
e2fsck -b backup_position -y /dev/sdb1 # returns many errors hence the -y
However, I have been unable to recover anything. I used testdisk to write a new partition table that matched what I had before. When I then run e2fsck I get many different errors. I get a filesystem after that but it's completely empty, no files.
The lost+found directory is full of files (recovered ones I think) but I need to recover the directory tree, not just the files. I need the filename and previous directories to know what the files are (microscope images, mass spec data, etc.. Without the names and the directories where they were, they mean nothing).
I got another HD exactly the same and made a copy of the whole HD with dd so I can experiment recovery without losing anything. Any advice?
testdiskto recreate the partition. I will try withfdisk. – carandraug Sep 1 '12 at 17:41fdiskI couldn't even usee2fsckas it wouldn't find the superblock backups. I think the problem was that I couldn't edit the CHS (the new partition set it to 64 but should be 255) – carandraug Sep 1 '12 at 19:08