Fix ERROR_WRITE_PROTECT (0X00000013) – The media is write-protected
Your drive or SD card reports it's write-protected. This fix removes physical and software locks that trigger error 0x00000013.
Quick answer (for advanced users)
Run diskpart, select the disk, type attributes disk clear readonly. If that fails, check the physical lock switch on the SD card or USB drive.
Why this happens
Error 0x00000013 pops up when Windows detects the media is locked against writes. This isn't always a hardware failure. The culprit here is almost always one of three things: a physical lock switch on an SD card or USB stick, a corrupted partition table that tricks Windows into thinking the drive is read-only, or leftover registry entries from bad driver installs. I've seen this most often on cheap USB drives and SD cards used in Raspberry Pi or camera work. The drive itself might be fine — Windows just thinks it can't write.
Fix steps (in order of success rate)
- Check the physical lock switch. SD cards and some USB drives have a tiny slider marked “Lock.” Slide it to the unlock position. This sounds stupid, but it's the number one cause. If it's a microSD-to-SD adapter, the adapter itself might have a lock — try a different adapter.
- Run diskpart to clear the readonly attribute. Open Command Prompt as Admin. Type
diskpart, thenlist disk. Find your drive (size is a giveaway). Typeselect disk X(replace X with your disk number). Thenattributes disk clear readonly. If you see “Disk attributes cleared successfully,” you're done. If not, move to step 3. - Check for volume-level write protection. In diskpart, after selecting the disk, type
list volume, thenselect volume Y. Thenattributes volume clear readonly. This helps when the partition itself is locked but the disk isn't. - Fix with chkdsk. Run
chkdsk X: /f /r(replace X with your drive letter). This repairs file system corruption that can cause write-protection flags. It takes time but catches bad sectors that mimic a hardware lock.
Alternative fixes if the main steps fail
- Registry hack (advanced). If diskpart fails, the write protection might be baked into the Windows registry. Open
regedit, go toHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. If you see a DWORD calledWriteProtect, set it to0. If the key doesn't exist, create it. This fix is rare — I've only needed it on cursed loaner laptops with group policy nightmares. - Check for third-party encryption or backup software. Programs like VeraCrypt, BitLocker, or older Norton Ghost can set software write protection. Disable or uninstall them, then retry step 2.
- Try another port or PC. Sometimes a flaky USB controller misreads the drive. Plug it into a different port (preferably USB 2.0, they're less finicky) or another computer entirely. If it works on another PC, the issue is your motherboard, not the drive.
Prevention tips
- Always safely eject USB drives. Yanking them out can corrupt the file system and trigger write-protect flags on next plug-in.
- Avoid cheap SD adapters. The plastic lock switches on those things break within weeks. Buy a quality one from SanDisk or Kingston.
- Format your media in exFAT if you move it across Mac and Windows. NTFS can cause confusion on read-only scenarios in mixed environments. I've seen it more times than I want to count.
If none of this works, the drive's flash memory controller has likely failed. That's a hardware death — time to replace it. Don't toss data recovery money at a $15 USB stick.
Was this solution helpful?