I'm running Ubuntu 12.04, and recently tried to safely remove my external hard drive using the GUI, but the "Format" button was right next to the "Safely Remove" button. I stopped the format as soon as it started, but the hard drive won't mount now and I can't access any of the files. I tried to do a data rescue using GParted, but it couldn't find any partitions... any suggestions for recovering the lost data?

Needless to say, I now have a vendetta against GUIs.


photorec, despite its name, can be used to recover all sorts of files from a reformatted drive, including documents, photos, movies, etc. You may have better luck than normal because the format wasn't complete.

You'll need to have a different drive with at least as much free space as what you had used in your formatted drive in order to store the recovered files. It also may take some time piecing together different parts of files due to fragmentation of the formatted drive. Either way it's a good first step as it will recover a lot and won't make things worse for your formatted drive.

testdisk comes from the same family as photorec, but may offer tools to rebuild your disk's partition information and file structure without having to recover byte by byte. Many of these operations will write to the disk, so it's best to perform them on an image of the disk. You can create one using dd. This image will be an exact copy of the USB drive in its current state, including its MBR, partition layout, filesystem metadata, filenames, directory structure, as well as the values of all of the bytes on the disk. Of course, not all of this information is available on your USB disk anymore.

A typical dd command would be

dd if=/dev/sdc of=path/to/image.img

Make sure you know the device node of your USB drive (/dev/sdc in this example). You can find out by using fdisk -l (as root) or by looking in the directories under /dev/disk/. Also, the size of the output file with be the same as the USB drive so make sure you're placing it somewhere that has enough space.

  • 4
    Yes this. Plus (or first) photorec's "parent" program testdisk (which again does more than the name says). – mattdm Apr 24 '13 at 14:55
  • Thanks for the input! I don't currently have another 1TB hard drive, but I've been meaning to get one... so I guess now's the time! – Andrew Maurer Apr 24 '13 at 21:27
  • As @mattdm suggests, definitely check out testdisk too as you may be able to fix the partition table (but test on a dd'd copy of the drive so you don't make things worse). – drs Apr 24 '13 at 22:22
  • @drs What is a dd'd copy of the drive? – Andrew Maurer Apr 25 '13 at 4:28
  • @andybenji I updated the answer to provide information about dd – drs Apr 25 '13 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.