If your SD card shows up as unallocated space, asks you to format it every time you plug it in, or has lost a partition that used to be there, the data is usually still on the card and the partition table just needs rebuilding. The practical order of operations is: stop writing to the card, clone it first, recover the files with recovery software that reads raw sectors, and only then rebuild the partition table. Formatting is the last step, not the first, and only after you have your files back. If the card is physically failing — it disappears from the computer, gets hot, or throws read errors — stop and replace it; partition work cannot fix dying flash memory.
What You'll Need
- A computer with a built-in SD slot or a known-good USB card reader (a flaky reader mimics a dead card, so test with a second one if you can)
- A second drive with enough free space to hold an image of the card or the recovered files — at minimum as large as the card itself
- Partition and recovery software that can scan raw sectors. Free options include the official builds of TestDisk and PhotoRec, or the free tier of a reputable recovery tool. Windows also has Disk Management and
diskpartbuilt in; macOS has Disk Utility. - The card's original files, if you have a backup — that is faster and safer than any recovery attempt
Menu names and wording differ slightly between software versions and operating systems, so treat the paths below as guides rather than exact labels.
Step-by-Step
- Stop using the card immediately. Every write — including a format prompt you accept, a thumbnail cache, or a new file — can overwrite the data you are trying to recover. Eject it cleanly and set it aside until you have a plan.
- Confirm what the computer sees. On Windows, open Disk Management (right-click the Start button and choose it) and look at the card's entry. A card with a lost partition usually shows unallocated space or a partition marked RAW. On macOS, open Disk Utility and switch to Show All Devices so the physical card is visible, not just its volumes. Note the capacity and whether the card appears at all.
- Clone the card before touching it. Recovery tools and partition rebuilds write to the card. Make a sector-by-sector image first so a mistake is repeatable and harmless. On Windows, you can use a disk imaging tool or
ddfrom a Linux live session; the command shape isdd if=/dev/sdX of=/path/to/card.img bs=4M status=progress, where/dev/sdXis the card — double-check that letter, because pointingddat the wrong disk destroys it. On macOS, Disk Utility's File > New Image > Image from Device does the same job. - Work on the image, not the original. Mount or open the image file in your recovery software. This keeps the original card untouched as a second copy of the evidence.
- Run a partition scan. In TestDisk, select the image or card, choose the partition table type (Intel for most SD cards, sometimes GPT on larger cards), then Analyse and Quick Search. It looks for partition signatures left behind when the table was damaged and lists what it finds. If Quick Search finds nothing, run Deeper Search, which takes much longer but scans the whole card.
- Check the found partitions before writing. TestDisk lets you list files inside a candidate partition with the P key. Only if you can see your folders and files should you proceed. If the listing is garbage or empty, that partition is not the right one.
- Write the partition table back. With the correct partition highlighted, choose Write and confirm, then quit and reboot or reinsert the card. The card should now mount normally with its files in place.
- If the partition cannot be rebuilt, recover the files directly. Use a raw-scanning tool such as PhotoRec, or the deep scan in a commercial recovery suite, pointed at the image. Choose an output folder on your computer's drive, never the card itself, and select file types if you want to narrow the scan. PhotoRec ignores file names and folder structure, so recovered files come out numbered — that is normal and not a sign of failure.
- Copy recovered files off in batches and verify. Open a sample from each file type to confirm it is intact before you delete the image. Photos, video and documents behave differently: video is the most likely to come back partially damaged, so check playable files end to end.
- Reformat only now, if you need the card back in service. Once the data is safe elsewhere, format the card in the camera or device that will use it, or with the SD Association's official formatter. This clears the bad partition table and gives you a clean card.
Common Mistakes
- Accepting the format prompt. The single most damaging move. A quick format overwrites the partition table and file system structures; a full format can wipe far more.
- Recovering files back onto the same card. The output folder must be on another drive, or the recovery writes over what it is trying to save.
- Skipping the clone. If a rebuild goes wrong on the original, there is no second chance. The image costs one extra drive and a few minutes.
- Confusing a partition problem with a hardware failure. If the card drops out mid-copy, is detected with the wrong capacity, or a reader reports I/O errors, stop — software cannot repair failing NAND.
- Assuming a rebuilt partition means everything is fine. Verify a few files before trusting the result, and copy the whole card to a computer for safekeeping.
Tips
- Work on a card reader plugged directly into the computer, not through a hub, and avoid USB 2.0 ports for long scans.
- Label your image files with the date and card capacity so you never mix two cards up.
- If the card holds camera footage, note that in-camera clips are often split into several files; recover them all and play them in sequence to check.
- After a successful recovery, reformat the card in the device that will use it and always eject it properly — most lost partitions come from pulling the card or losing power mid-write.
- Keep a second copy of anything important. An SD card is working storage, not a backup.
Troubleshooting
The computer does not see the card at all. Try another reader, another port, and if possible another computer. If it is still invisible in Disk Management, the controller or memory is likely failing and software recovery is not going to help; a professional data recovery service is the remaining option.
The card appears with the wrong capacity, such as a fraction of its stated size. That points to a failing card or a fake card whose real capacity is smaller than advertised. Stop writing to it and recover what you can immediately.
TestDisk finds nothing even on Deeper Search. The partition table is gone beyond signature recovery, but the files may still be there. Run a file-carving scan with PhotoRec or a commercial deep scan, which finds files by their internal structure rather than by partition.
The rebuild succeeds but the card still asks to format. The partition table was found but the file system inside it is damaged. Go back to file recovery rather than formatting; once you format, the old structures are gone.
Recovered files are corrupt or zero bytes. Either the scan read the wrong region or the data was already overwritten. Try a different scan mode, check that you pointed the tool at the image and not a partition, and accept that some files written over after the loss cannot be saved.
The card write-protects itself. Many cards lock into read-only mode when they detect internal trouble. That protects your data, so recover from it rather than fighting the lock — the card should be retired afterward.
Frequently Asked Questions
Can I recover a partition without any software?
Not realistically. Windows Disk Management and macOS Disk Utility can create and delete partitions but cannot rebuild a lost one or read raw data. You need a tool that scans for partition signatures or recovers files directly.
Is a quick format on an SD card really destructive?
It destroys the file system structures, but the file content often survives until it is overwritten. That is why recovery after an accidental format sometimes works — but it becomes far less likely with every new write to the card.
Does recovery software work on a card that was pulled out mid-write?
Sometimes. Photos usually come back; video and files that were being written during the interruption are the most likely to be truncated or missing.
Will rebuilding the partition delete my files?
Writing a correct partition table back should not touch the data inside the partition. Writing the wrong one can make things worse, which is why you check the file listing first and keep an image copy.
Why does the card work in the camera but not in my computer?
Some cameras use formats or partitions a computer may not mount automatically, and some readers have trouble with certain cards. Test with a different reader before assuming the card is damaged.
How long do the scans take?
A partition scan can finish in minutes; a full deep scan of a large card can run for hours. That is normal, so let it run to completion rather than stopping early.