I accidentally formatted a USB stick using dd.

I ran dd to copy an installation CD to a USB drive but chose the wrong device.

Is there any way of recovering the data?

The previous file system probably was FAT32.


TLDR: Probably no chance.

When you used dd to write to the device you overwrote the old data. What you overwrote is gone. There is no way of recovering that barring some luck, NSA expertise and very expensive equipment.

If you are very lucky then you only wrote a a limited amount of information to the pen drive (e.g. dd a 5 MB iso to a 4 GB pen drive, thus overwriting only the first part). If the data you want to recover is not located on the part which you overwrote then disk recovery programs might succeed.

Note that FAT stores its file information at the beginning of the partition, so you probably lost all file names. What you may recover probably ends up as file1, file2, ...

  • It was 32GB and I did ctrl c to stop dd. Anyone reckons there's a chance. How would I go about checking? Oct 5 '13 at 18:15
  • Same as for data recovery on normal drives: 1) Make a backup of the drive (e.g. using dd). 2) Try recovering the data. Either from the backup you just make or from the pen drive. If that fails you can always recover using the backup from step 1. Photorec seems to be an often recommended option, though I have no experience with it.
    – Hennes
    Oct 5 '13 at 18:37
  • Hi, thanks for your time. I can see the files with photorec, but they have no names. tried testdisk... no files were shown. There are so many files, how do I get the names back? Oct 5 '13 at 18:42
  • I doubt you'll get the names. Your best shot is to get the files first, and then start going through them one by one to see which are the files you wanted. Unfortunately data recovery is never an easy thing to do.
    – Darius
    Oct 5 '13 at 19:34
  • With the FAT filesystem the names are stored at the beginning of the partition. You overwrote those. So there is no way to get the names back.
    – Hennes
    Oct 5 '13 at 19:49

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.