A corrupted SD card is one of those problems that looks like the card is dead but often isn’t. Windows refuses to open it, Win32 Disk Imager won’t flash it, the card shows weird capacity or won’t mount at all. Before you toss it in the trash, there’s a 60% chance you can revive it with the right sequence of repair steps. SD cards typically fail in recoverable ways long before they become hardware-dead, and the recovery procedures are well-established.
This is the guide for what to do when an SD card is in a weird state and you can’t flash it with Win32 Disk Imager. I’ll walk through diagnosing whether it’s software corruption (recoverable) or hardware failure (not recoverable), the repair sequence that works most often, and the nuclear options when everything else fails. Plus how to extract data from a dying card before you give up on it.
TL;DR: In order: (1) try a different USB reader to rule out reader issue. (2) Run CHKDSK on the card. (3) Format with SD Card Formatter (Overwrite mode). (4) If still broken, use diskpart’s clean command. (5) Last resort: vendor-specific repair tools (SanDisk RescuePRO, Samsung Magician). If none work, the card is hardware-dead.
Is It Software Corruption or Hardware Failure?
Diagnostic first. Symptoms that point to recoverable software issues:
- Windows offers “Format disk?” dialog when you insert.
- File Explorer shows the drive but with wrong capacity (e.g., 32 GB card shows as 100 MB).
- CHKDSK reports errors that can be fixed.
- Card works in another PC’s USB reader.
- Card works in a camera/phone/Pi despite Windows issues.
Symptoms pointing to hardware failure (unrecoverable):
- Card not detected at all by Windows, different PCs, different readers.
- Read/write errors across the entire card surface (h2testw shows universal failure).
- Card gets unusually hot during use.
- Physical damage (bent pins, water damage, cracked casing).
- Card was previously running a heavily-written workload (Home Assistant, OctoPrint) for 2+ years.
Software corruption is fixable. Hardware failure isn’t. This guide focuses on software. For hardware failure: recover what data you can and replace the card.
Step 1: Try a Different Reader
Before repairing the card, rule out reader issues. A failing USB card reader produces the same symptoms as a failing card: weird errors, unmounts, etc.
Test: plug the card into a known-good reader (different physical reader than the one you’ve been using). If the card works in a different reader, the original reader was the problem, not the card.
If the card fails in multiple readers, it’s the card. Proceed to repair steps.
Step 2: Run CHKDSK
Windows’ built-in filesystem repair tool. Handles the most common corruption scenarios.
- Open admin Command Prompt.
- Run
chkdsk E: /f /r(replace E: with your SD card’s drive letter). - CHKDSK analyzes the filesystem and repairs errors. Takes 2-10 minutes depending on card size.
Flags:
/f(fix): fixes found errors./r(recover): locates bad sectors and recovers readable info. Slow but thorough./x: force dismount the volume before check (useful if apps are using the card).
If CHKDSK completes successfully: card is repaired. Try Win32 Disk Imager now.
If CHKDSK reports “File system is RAW” or “Cannot lock current drive”: more severe corruption. Move to step 3.
Step 3: Format With SD Card Formatter (Overwrite)
The SD Association’s official tool handles SD-specific quirks better than Windows Format dialog. Available at sdcard.org/downloads/formatter. Free.
- Download and install SD Card Formatter.
- Launch as administrator.
- Select the SD card from the dropdown.
- Pick Overwrite format (not Quick; important for corrupted cards).
- Give it a volume label if desired.
- Click Format. Takes 2-5 minutes for a 32 GB card in Overwrite mode.
Overwrite format writes zeros to every sector first, then creates a fresh filesystem. This fixes:
- Broken partition tables.
- Phantom partitions Windows can’t clean up.
- Filesystem signature conflicts.
- Metadata corruption.
After Overwrite format: card is effectively factory-fresh. Try Win32 Disk Imager. 70% of corruption cases resolve here.
Step 4: diskpart Nuclear Option
If SD Card Formatter fails (rare), the card has unusual partition metadata that Windows’ tools won’t touch. Use diskpart’s clean command:
- Open admin Command Prompt.
diskpartlist disk— identify your SD card’s disk number by matching the size.select disk N(replace N; triple-check it’s the SD card).clean— wipes all partition metadata. Card is now truly blank.- (Optional)
clean all— writes zeros to every sector. Slow (hours on big cards) but most thorough. create partition primaryformat fs=exfat quick(or fat32 / ntfs)assign letter=Eexit
Card is fresh, ready for Win32 Disk Imager use. See our format via CMD guide for diskpart details.
⚠️ Heads up: diskpart clean is destructive. All data on the selected disk is gone. Verify the disk number is your SD card before running clean.
Step 5: Vendor-Specific Repair Tools
For cards that diskpart can’t touch (extremely rare), manufacturer-specific tools:
- SanDisk RescuePRO: paid, but has free trial. Recovers files from damaged SD cards.
- Samsung Magician: for Samsung SSDs, but Samsung’s SD tools are minimal; may not help cards.
- Kingston URescue: similar to RescuePRO.
- Transcend RecoveRx: free, works on most brands.
These are mostly data-recovery tools, not repair tools. They extract files from damaged cards rather than fixing the card itself. Useful if you need data before replacing the card.
For actual card repair (not data recovery), vendor tools rarely help more than diskpart. If diskpart didn’t revive it, accept the card is hardware-dead.
Alternative: Recover Data From a Failing Card Before Replacing
If the card has valuable data (Pi OS install, photos, project files), extract before repair/replace:
Option A: Linux dd with error skipping. From a Linux Live USB or WSL:
sudo dd if=/dev/sdX of=/mnt/d/corrupt.img conv=sync,noerror bs=4M status=progress
conv=sync,noerror tells dd to fill bad sectors with zeros and continue instead of aborting. Slow on cards with many bad sectors but salvages what’s readable.
The resulting .img has gaps where bad sectors were, but intact data for the rest. Mount the .img with loop device and copy files out.
Option B: Recuva / PhotoRec. File-signature-based recovery tools. Scan the card for known file types (JPG, MP4, etc.) and extract them regardless of filesystem corruption.
- Recuva: Windows, free. Best for accidentally-deleted files.
- PhotoRec: cross-platform, free. Best for damaged filesystems.
- R-Studio: paid, most thorough. For business-critical recovery.
Option C: Professional recovery service. For truly critical data (business-critical, irreplaceable photos), professional services with clean-room facilities can recover data even from physically damaged cards. Expensive ($300-2000) but sometimes necessary.
Verifying Card Health After Repair
After repair, verify the card is actually healthy before trusting it with new data:
h2testw (recommended):
- Download from heise.de/download/product/h2testw-50312 (free, German freeware).
- Plug in the card.
- Launch h2testw as admin.
- Select the card’s drive letter.
- Click “Write + Verify.” Writes test patterns to every sector, reads back, reports errors.
- Takes 10-30 minutes for 32 GB card.
Pass: “Test finished without errors.” Card is good.
Fail: “Writing was aborted” or “The media is likely to be defective.” Bad sectors found. Card is hardware-failing; replace.
Alternative: F3 (cross-platform) or Victoria (free Russian tool) do similar tests.
Prevention: How to Avoid Corruption
Common causes and prevention:
- Ungraceful removal. Pulling a card out while it’s being written is the #1 corruption cause. Always use Windows’ Safely Remove Hardware eject, or shut down the Pi cleanly before pulling.
- Power failure during write. Power loss mid-write can corrupt the filesystem. Use a UPS for Pi, or at least do backups/major-changes when on stable power.
- Low-quality SD cards. Counterfeit or bargain cards fail fast. Spend the $15 on a SanDisk Extreme or Samsung Pro Endurance.
- Heavy write loads. Pi with constant logging / databases burns through regular SD cards in 1-2 years. Use High Endurance cards or migrate data to USB SSD.
- Physical damage. Don’t bend, don’t get wet, don’t leave in extreme heat.
- Mounting/unmounting in too many devices. Each mount/unmount cycle risks filesystem metadata corruption.
Common Symptoms and Quick Diagnoses
Quick-reference for mapping symptoms to causes:
“The disk is write-protected”: physical lock slider or software write-protect flag. Check slider; if fine, run diskpart attributes disk clear readonly.
“You need to format the disk”: Windows sees a partition it can’t read (usually ext4 from a Pi). Not necessarily corruption; just unrecognized filesystem. Click Cancel, it’s fine.
“Cyclic redundancy check (CRC) error”: bad sector hit during read/write. Run chkdsk /r to mark bad sectors and move data. If CRC persists, card is hardware-failing.
“I/O device error” or “Error 21 the device is not ready”: card isn’t responding. Try different reader; if same, card has controller-chip failure. Likely unrepairable.
“The parameter is incorrect”: filesystem metadata corruption. CHKDSK should repair.
“Windows cannot access the disk”: various causes. Try reader change first, then diskpart clean.
Special Case: Card Shows 0 Bytes or Won’t Format
Specific nasty corruption: Windows sees the card but reports 0 bytes capacity, or refuses to format with “Windows was unable to complete the format.”
Procedure:
- Check the card’s physical lock slider. If on Lock position, slide to unlock.
- In diskpart, after selecting the disk, try
attributes disk clear readonlyto remove any write-protect flag. - If format still fails, try a different filesystem:
format fs=fat32 quickinstead of NTFS. - If all formats fail, card has severe hardware issues or a broken controller chip. Replace.
Write-protect flags can be stuck even without physical slider issues. Diskpart’s attribute clear resolves this.
The Fake-Capacity Trap
Counterfeit SD cards report a fake capacity to Windows but actually have much less physical storage. A “256 GB” fake card may only have 8 GB of real flash, with the rest just looping back on the first 8 GB. Data past 8 GB silently gets overwritten.
This isn’t “corruption” in the normal sense; the card is working as designed (counterfeit design). Detection: h2testw catches this immediately (writes past ~8 GB fail or wrap around). Victim cards are often from dodgy marketplaces, not legitimate stores.
No repair possible. Return for refund or discard.
Real Case: Reviving a Pi Home Assistant Card
Actual example from 2024. A friend’s Home Assistant Pi SD card started throwing I/O errors in logs. HA still mostly worked but was slow. Pulled the card, plugged into Windows:
Symptom: Windows offered “Format disk?” for both partitions. File Explorer couldn’t see any content.
Step 1: different USB reader. Same symptoms. Card issue confirmed.
Step 2: before repairing, ran Linux dd with conv=sync,noerror to back up what was readable to an .img file. 15 minutes, ~90% of the card recovered (some bad sector zeros filled in).
Step 3: SD Card Formatter Overwrite. Completed successfully.
Step 4: h2testw wrote and verified the whole card without errors. Card was fine after repair.
Step 5: Win32 Disk Imager restored the previous week’s Home Assistant backup IMG. HA booted with full config, losing only ~5 days of history due to the backup age.
Total time: 45 minutes. Card was not quite “fixed” in the sense that h2testw passed, but given the prior I/O errors, I flagged it as suspect and used a new card for the actual restore. Old card went into “spare parts drawer.”
Lesson: even when repair succeeds, an SD card that previously threw I/O errors should be trusted for non-critical use only. Home Assistant’s long-term reliability needs fresh hardware.
Repair Tools Comparison
Quick reference for the main repair tools:
| Tool | Source | Does | Best For |
|---|---|---|---|
| CHKDSK | Built-in Windows | Filesystem repair | Minor filesystem errors |
| SD Card Formatter | SD Association | SD-specific format | Metadata corruption |
| diskpart | Built-in Windows | Low-level format | Stubborn cards |
| h2testw | Freeware | Verify card health | Post-repair validation + counterfeit detection |
| PhotoRec | CGSecurity | File signature recovery | Extracting data before repair |
| Recuva | Piriform (free tier) | Deleted file recovery | Accidental deletion |
| dd (Linux) | Built-in Unix | Raw copy with error skip | Salvaging dying cards |
| Vendor tools | SanDisk/Samsung/etc | Data recovery only | Last-resort file recovery |
Start with CHKDSK, escalate as needed. h2testw is the verification step; run it after any repair to confirm the card is reliably fixed.
When to Give Up
Signs the card is actually dead:
- h2testw shows systemic write failures across the card.
- diskpart clean succeeds but subsequent format always fails with “I/O error.”
- Card not detected even after trying 3+ readers and different USB ports.
- Card is physically damaged.
- Recovery tools find data fragments but can’t reassemble usable files.
When these are true: accept the card is gone. Replace with a quality brand (SanDisk Extreme / Samsung PRO Endurance). For your Pi projects, keep regular IMG backups (see our SD backup guide) so card failure is an inconvenience, not a disaster.
The Detailed Repair Decision Tree
Flowchart for picking the right repair path:
- Does Windows detect the card at all? No → hardware failure or reader issue. Try different reader first. If still not detected: card is dead.
- Does File Explorer show the correct capacity? No → run CHKDSK first, then Step 4 diskpart clean if CHKDSK fails.
- Does CHKDSK report “file system is RAW”? Yes → skip to Step 3 SD Card Formatter. If that fails, go to Step 4 diskpart.
- Does the card have valuable data that wasn’t backed up? Yes → try Option A (dd with noerror) or Option B (PhotoRec) before any destructive repair.
- After repair, did h2testw pass? Yes → card is reliably fixed. No → hardware-damaged, replace.
Following this tree handles 95% of SD corruption scenarios in 30-45 minutes.
FAQ
How long does SD corruption repair typically take?
CHKDSK: 5-10 minutes. SD Card Formatter Overwrite: 2-5 minutes. diskpart clean + format: 1-2 minutes. h2testw verification: 10-30 minutes. Full repair cycle: ~30-45 minutes.
Will CHKDSK erase my data?
CHKDSK attempts to preserve data while fixing errors. /f flag may relocate or discard unrecoverable bits. If data preservation is critical, back up first (with dd conv=noerror) before running CHKDSK.
What about Disk Management Repair?
Windows 10/11’s Disk Management doesn’t have a repair feature, just Delete Volume / New Simple Volume. CHKDSK from Command Prompt is the built-in repair tool.
Can I use PhotoRec to recover from an encrypted card?
No. Encrypted data looks random to PhotoRec’s signature-matching. You’d need the encryption key/password to decrypt, then scan. If you can’t decrypt, data is gone.
Are there SD-specific issues that don’t affect USB sticks?
Sort of. SD cards have smaller flash, more write-cycle wear on busy workloads, and physical lock switches that can get stuck. USB sticks have similar corruption modes but larger flash pools and no lock switch. SD Card Formatter handles SD-specific metadata better than generic Windows Format.
Does ChkDsk work on ext4 (Linux) filesystems on SD cards?
No. Windows CHKDSK only handles Windows filesystems (NTFS, FAT32, exFAT). For ext4 (Pi OS root partition), use Linux fsck from a Live USB or WSL.
How do I know if my SD card is counterfeit?
h2testw catches counterfeits during Write+Verify test. Also: price. A “256 GB SanDisk Extreme Pro” for $5 is counterfeit. Real cards cost $20-50 depending on speed rating.
What’s the write-endurance difference between Class 10 and A2 rated cards?
Class 10 guarantees 10 MB/s sustained write. A2 guarantees faster random read/write (important for Pi OS app responsiveness). A-ratings don’t directly predict endurance; endurance is a separate spec. High Endurance lines are tested for 2000-5000 write cycles vs 500-1000 for budget cards.
Can I prevent Pi from killing SD cards via software tweaks?
Yes. Mount root as read-only where possible, redirect logs to tmpfs (RAM), use an external USB SSD for high-write workloads (databases, Home Assistant history). Reduces SD wear dramatically.
Do I need to reformat after every Win32 Disk Imager session?
No. Normal Win32 Disk Imager Write replaces the IMG contents cleanly. You only need to reformat if you’re repurposing the card for non-Pi use (see our capacity recovery guide).
Can I use the card in a camera after repair?
Yes, after formatting to FAT32 (under 32 GB) or exFAT (over 32 GB). Most cameras prefer exFAT. Do a final in-camera format after plugging it into the camera; some cameras set specific metadata during their format.
Should I buy cards with built-in backup features?
Some SD cards claim “backup” features (SanDisk iXpand, Transcend SD Mate). These are proprietary apps for specific use cases (iPhone backup, etc.), not real protection against corruption. Don’t rely on them. Real backups come from Win32 Disk Imager Read to a separate IMG file on a separate drive.
Wrapping Up
A corrupted SD card is usually recoverable with CHKDSK + SD Card Formatter. When those fail, diskpart clean is the nuclear option. Verify with h2testw before trusting the card for new data. Once repaired, Win32 Disk Imager can flash fresh IMGs to it normally. For prevention, keep regular IMG backups via our SD backup guide. For the broader Win32DI troubleshooting context, see not detecting, stuck at 0%, Error 5, and the capacity recovery guide.
Related Guides
Pair this guide with the rest of the Win32 Disk Imager knowledge base. These cover the adjacent workflows you’ll hit when working with disk images, bootable USBs, and Windows partition management.
- Win32 Disk Imager Not Detecting USB / SD Card — Fix Guide — Empty Device dropdown fixes — full reset sequence, Virtual Disk Service restart, driver updates, and the Google Drive/OneDrive interference trap.
- Win32 Disk Imager: Not Enough Space on Disk — Causes + Fixes — Why your 32 GB IMG won’t fit on your 32 GB SD card — PiShrink, SD card size variance, counterfeit detection, and the Read destination-space trick.
- SD Card Shows Less Capacity After Imaging — Restore Full Size — Why your 64 GB card looks like 5 GB after flashing, and four ways to reclaim full capacity for Pi or Windows use.
- How to Back Up an SD Card to an IMG File on Windows — Back up a Raspberry Pi SD card to an IMG file on Windows — full Read walkthrough, PiShrink compression, and a backup-schedule template.
- Win32 Disk Imager Has Stopped Working — Mid-Operation Crash Fixes — Mid-operation crash diagnosis: Event Viewer module names, USB driver fixes, AV interference, dying SD recovery, plus a 10-step diagnostic order.