Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

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, ...

share|improve this answer
    
It was 32GB and I did ctrl c to stop dd. Anyone reckons there's a chance. How would I go about checking? –  user2824664 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? –  user2824664 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
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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