When an SD card flashes "You need to format the disk in drive X: before you can use it," the photos are not gone. The card has failed or its file system has turned unreadable, but the image data usually sits intact on the platters. Recovery runs in two stages: pull the raw image data off a card that will not mount, then fix any broken JPEGs that emerge from that extraction. Stop using the card right now. Hit Cancel when Windows offers to format. Then follow the steps.
Stop and Assess the Card
Click Cancel at the format prompt. Never click Format. That rewrites the file system and stomps the data you need. Pull the card from the camera or reader. Do not shoot another frame. Every new write risks overwriting recoverable data. If the card shows physical cracks or a bent controller, further use deepens the damage.
Stage 1 Card-Level Recovery
Work with the card when it will not mount or reports a raw file system. Skip the broken file structure. Scan the raw bytes with a tool that ignores the corrupted directory entirely.
Create a Disk Image First
A card with bad sectors or a failing controller needs imaging before anything else. Use ddrescue to pull a copy onto a healthy drive. That copy takes the stress, not the card. If the card is stable and only logically scrambled, skip the image and scan it directly.
Extract Files by Signature
PhotoRec ignores the file system and hunts for file signatures. It is free, open source, and bundled with TestDisk. Windows, macOS, and Linux all run it. To use it:
- Launch TestDisk. PhotoRec lives inside the same package.
- Point it at the drive letter or disk image that matches your SD card.
- Pick the partition type. Intel covers most SD cards.
- Choose the file system type. Select "Other" for a raw scan when unsure.
- Check the file types to recover. JPEG is on by default.
- Set a destination folder on a different drive. Never write back to the card.
- Start the scan. The utility sweeps the entire card for signatures, blind to the broken file system.
Recovered files land in folders named recup_dir.1, recup_dir.2, and onward. Names are generated, so you will sort through them later. The tool spots JPEGs by the start signature FF D8 FF.
What to Expect After Signature Recovery
A scan often returns hundreds or thousands of files. Many are thumbnails, system fragments, or partial writes. Hunt for the .jpg and .jpeg extensions. Some JPEGs open only partway. That happens when the file is fragmented on the card and the recovery tool mixes data from different clusters. The image shows correct content at the top, then garbage. These broken files feed the second stage.
Deleted photos that were recently erased also surface. The tool does not consult the file table, so one pass recovers both lost and deleted shots from the raw media.
Stage 2 Fix Broken JPEGs
Some recovered JPEGs refuse to open or display only a strip of the image. The file structure is broken, but usable image data sits inside. Repair re-encodes the intact portion into a clean JPEG.
Spot the Files That Need Work
Open each recovered JPEG. A partial render means a fragmented or truncated file. A file that will not open at all may be too far gone or not a valid JPEG. Keep only the ones that show some picture.
Re-encode the Salvaged Image
A partially opening JPEG can be re-encoded to a clean file. The process reads the valid image data from the broken container and writes it into a properly structured JPEG. The tool matters less than the principle: extract what is good, discard the corrupted tail. After re-encoding, the repaired file opens fully. Sections overwritten by stray data stay lost.
Using Jpeg.repair for the Second Stage
Once you have raw JPEGs pulled from the card, some need fixing. jpeg.repair is a free online service that rebuilds corrupted JPEGs without slapping on a watermark. Upload the broken file. The service reconstructs a clean version. It handles the corruption patterns common in files pulled from a raw file system or from a card that demanded formatting. This works for those partially opened images your recovery pass produced.
Preventing Future Card Corruption
Stop corruption before it starts:
- Eject the card properly every time you pull it from a computer or camera.
- Format the card inside the camera, not on a computer. The camera writes its own file system.
- Retire cards that are more than a few years old or have seen heavy use.
- Keep backups of important photos on a separate drive or in cloud storage.
A card that shows write errors or sluggish performance is failing. Stop using it immediately. Copy every remaining photo to a safe location.