LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Wrote an image to the wrong drive with dd (https://www.linuxquestions.org/questions/linux-software-2/wrote-an-image-to-the-wrong-drive-with-dd-4175468202/)

shaheenm 07-02-2013 12:28 PM

Wrote an image to the wrong drive with dd
 
Hi there

I've made a monumental error. I was trying to write a raspberry-pi image from my usb hdd to my micro-SD card and mistakenly wrote the image back to my usb hdd.

The HD is a 250Gb and was formatted as FAT32. The rPi image is about 2Gb and basically overwrote my FAT32 partition tables. I know that the 2Gb that were written have been lost, but all my other data should still be on the drive. I just need to be able to get to it.

I used fdisk to try to set it back to a single FAT32 partition by deleting all the partitions from the rPi image and creating a FAT32 partition. fdisk accepts this but I cannot mount the drive.

I've made an image of the entire drive but it too will not mount.

Any help would be appreciated in trying to recover this. How do I create the partition tables whilst preserving the data? Or access the data so that I can get it back from the image?

Doc CPU 07-02-2013 12:44 PM

Hi there,

Quote:

Originally Posted by shaheenm (Post 4982689)
I've made a monumental error. I was trying to write a raspberry-pi image from my usb hdd to my micro-SD card and mistakenly wrote the image back to my usb hdd.

that's really bad luck, especially as you don't seem to have a backup of your data.

Quote:

Originally Posted by shaheenm (Post 4982689)
The HD is a 250Gb and was formatted as FAT32. The rPi image is about 2Gb and basically overwrote my FAT32 partition tables. I know that the 2Gb that were written have been lost, but all my other data should still be on the drive. I just need to be able to get to it.

If you wrote 2GB, you sure as hell wiped not only the partition table, but also the boot sector and the additional file system info sector of the FAT32 partition, as well as the FAT itself (which was between 32MB and 256MB in size, depending on the cluster size you selected when formatting the drive), and some of the files as such.

Quote:

Originally Posted by shaheenm (Post 4982689)
I used fdisk to try to set it back to a single FAT32 partition by deleting all the partitions from the rPi image and creating a FAT32 partition. fdisk accepts this but I cannot mount the drive.

Of course you cannot. All information about the FAT32 file system is lost, there's nothing left to identify it as what it used to be.

Quote:

Originally Posted by shaheenm (Post 4982689)
I've made an image of the entire drive but it too will not mount.

For the same reason.

Best advice I can give you is to try TestDisk, which is included in the repos of many Linux distros. Contrary to the name, its main purpose isn't testing a disk, but rather recovering data you thought was lost. I don't want to foster too much hope, but it's worth a try. Be prepared to face the worst, though.

[X] Doc CPU

estabroo 07-02-2013 12:59 PM

http://askubuntu.com/questions/14736...at32-hard-disk

shaheenm 07-02-2013 01:22 PM

Quote:

Originally Posted by Doc CPU (Post 4982701)
Best advice I can give you is to try TestDisk, which is included in the repos of many Linux distros. Contrary to the name, its main purpose isn't testing a disk, but rather recovering data you thought was lost. I don't want to foster too much hope, but it's worth a try. Be prepared to face the worst, though.

[X] Doc CPU

Testdisk isnt much help, and photorec recovers files but loses all the filenames. and alot of the files are fragmented. Basically what i need to recover is my Series folder, movies folder, and a recent backup of work and downloads. my backup has word docs, source code, applications, basically a variety of files. I was hoping there would be a way to mount the image and ignore the first 2Gb so that I could access the rest. I'm trying Foremost now, hopefully that is able to provide some solution.

Thanks for the analysis though.

pierre2 07-03-2013 10:05 AM

something that bad, will generally require some commercial recovery software :(


All times are GMT -5. The time now is 10:39 PM.