Score:0

How to recover partition/filesystem from failed dd command

lt flag

I have a server with two SSDs of 250GB each.sda contained all my stuff while sdb was empty. I was trying to copy drive sda to drive sdb using the following command:

dd if=/dev/sda of=/dev/sdb conv=noerror,sync

I ran the command over ssh. However before the process finished, my pc was closed, the ssh connection closed as well and so was the dd command. I thought it's not a big deal since I was copying FROM sda to sdb. But now I can't boot into my server, sda appears to have been damaged, the boot partition is missing, I can t mount the partition left on sda, sda1. On sdb there s nothing as well. Also sda1 appears to have overwritten the original boot & sda1 partition that held my filesystem.

Looking with TestDisk on the sda1 partition I could only see a lost+found empty directory on the partition. Using photorec I could recover files, mostly photos so I know for sure that the my files are still there.I just don't have a partition/working filesystem.

How could I recover the old partitions and filsystem from sda?

John Mahowald avatar
cn flag
Please edit your question to add the errors logged you get when attempting to fsck or TestDisk then mount these volumes. And which file system type. And where /boot and / were supposed to be and what sda1 is.
Score:0
cn flag

Regarding getting back up and running, figure out when this server needs to be repaired. Note it will take significantly longer to do analysis and recovery of block and file system corruption, versus a clean rebuild.

Restore from any backups that may exist. As your OS distro is busted, this will require a recovery environment. And possibly a clean install. Recovery of the broken storage can also happen, but you may need to run these in parallel to get up and running in a reasonable amount of time.

Should backups not exist and the data be valuable, do not do anything to the problem disks until consulting with a data recovery specialist. Obviously you do not have to use such services, but the fewer writes after the problem the better.

If what you say is true that sdb was the target device, and was blank, sda corruption would be mysterious.

Beware, however, that sda and sdb are not stable names, and may change depending on how hardware is enumerated and added. Going forward, on Linux it is safer to use one of the stable names under /dev/disk/by*. The last few digits of a LUN WWN are just as easy to confirm, and will not change.

Expired avatar
lt flag
Already did a backup image of the damaged disk with dd rescue. Then recovered some files mostly photos using photorec. Then I tried recovering the partition with testdisk. I ran a deep search and found the partition and even managed to mount it and the size appears to match the original partition. Problem is the partition contains only a `lost+found` directory with all my files. How would I be able to rebuild a filesystem from this partition?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.