I have a 2 GB Kingston microSD card which is about three years old. I put it in a reader today in my Windows Vista computer, wrote a 32 MB file onto it, safely removed it, and then tried to read it elsewhere. Nothing. Putting it back in the Windows Vista computer it now says:

You need to format the disk in drive F: before you can use it.

What should I do? I have access to many computers and OSes if your recommendations need that. I would be very sad if I lost all the contents of the card. Most of the data is backed up, but there are a few things that aren't. :(

Doing a

# dd if=/dev/sdg of=~/tmp/sd.bin

gives me a 2 GB file, and grepping the file it seems like lots of my data is still there. How can I put it back together?

6 Answers 6


Photorec is designed specifically for this. It looks at file headers for various well known files and recovers photos - it does however mangle up filenames so you may need to rebuild these from exif data.

CGsecurity also has an application called testdisk for whole drive recovery, which the OP ended up using. This is useful where you know the disk is in reasonably good shape.

In general, I'd use several different applications to improve my chances of recovery, and work off an image and/or store recovered files in a different folder.

  • 1
    Used testdisk (which is in the same package as photorec). See comment below. Sep 14, 2009 at 6:10
  • But how does it work if SD card is plugged into Android phone? I don't have a seperate card reader. It only shows local disks on PC
    – toddmo
    Apr 24, 2015 at 22:48
  • better to have it connected directly. IIRC most phones abstract out storage via mtp
    – Journeyman Geek
    Apr 24, 2015 at 23:12

A link to photorec was posted, but it only finds known file types. My files were of all random types. The nice thing, is photorec comes with testdisk.

Using testdisk, I worked on the image I made with dd :

# dd if=/dev/sdg of=~/tmp/sd.bin
# sudo apt-get install testdisk #if on ubuntu/debian
# testdisk ~/tmp/sd.bin
(Select the partition)
(Rebuild BS)

And there were most of my files! It scanned the image looking for a FAT filesystem. Just walk the filesystem and press c to copy important files to a directory on the local disk.

Thanks for pointing out that utility, The Journeyman geek


I've used ZAR with good results on several flaky CF cards. It should do just as well with a microSD, I would expect. For photo recovery, it's free. For more complete filesystem analysis and recovery of many more kinds of files, they want money, but I'm not sure that the free version won't recover everything allowing you to try before you buy.


I had a damaged SD card, was working on minute, next time I turned on the camera, card no longer recognized and prompt to format. It had a good number of photos and videos on it. I tried it in a mac, a PC, multiple cameras. Cameras wanted to format it as it couldn't read it and computers simply did not recognize it at all (so all those posts about using software to recover files, no luck, as those all need the computer to at least recognize something is in the drive). I tried a local place in NYC that gets great reviews for recovering electronic data - no luck. I then got in touch with Transcend, the vendor, and I shipped it to the US base in California where they had no luck. Then they shipped it Taiwan (yes this SD card has been all over the world!) for the real makers to work their magic. NO LUCK. I asked them to ship the damaged one back instead of replacing it with a new one which they said they would do as I knew I had one last option left that I was a bit skeptical about.

I then shipped it to Dresden, Germany to a place called RecoverFab: http://recoverfab.com/ 1-2 days after they received the damaged SD card, they have uploaded 100 thumbnails to show proof they've recovered photos, and they have emailed me they recovered 370+ photos and 90 videos. Once I pay (not a small amount) they will give me an FTP site to download from so I don't need to wait for more shipping overseas of a DVD or something to get my data. SUCCESS!

The makers of my SD card could not recover data off of it, RecoverFab did.

I'm sold.


I've used GetDataBack to successfully receover deleted files from an SD card in the past, I've also used it to recover files from a hard drive that Windows couldn't read. So I think it could quite probably do what you're.

It has a free version that scans for recoverable files, but doesn't actually recover anything, so if you give it a go you'll know whether it'll work for you or not without having to hand any money over.


Part of the recovery is renaming the pictures, which lose their original filenames and therefore sorting order during recovery (e.g., via the photorec method mentioned above). Pictures can be renamed using the date and time variables stored in their exif data (if present), using exiftool.


sudo apt install libimage-exiftool-perl

Within the directory containing the recovered pictures, run:

exiftool '-filename<CreateDate' -d 20%y%m%d_%H%M%S%%-c.%%le -r -ext jpg .

which will rename the files to something like 20210629_094219.jpg.

Other files within the same directory such as videos will be safely ignored. The above command can be easily modified for different image formats and to add various prefixes/suffixes as needed (e.g., "IMG"). Adapted from source, which contains many more explanations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .