"The disk is write-protected": how to fix a USB stick or SD card you can't write to

You try to copy a file or format the stick and get "The disk is write-protected" or "Media is write protected". Sometimes it's a tiny switch, sometimes a setting, and sometimes the flash has worn out and locked itself to protect your files.

Find out which kind it is

SignMost likely causeCan it be fixed?
SD card, read-only everywhere, lock slider pushed downThe physical lockYes: slide it up towards the contacts
Read-only on one computer, fine on anotherA setting on that computer (registry, policy, encryption rule) or its card reader misreading the switchYes, on that computer
Only NTFS drives are read-only, and only on a MacmacOS reads NTFS but doesn't write itYes: see read-only on a Mac
Read-only on every computer, format fails, files still openThe controller has locked itself read-only because the memory is worn out or failingNo, but the files can usually still be copied off
Files copy, but later turn out corrupted past a certain amountA fake-capacity stick that reports more space than it hasNot really: test it with H2testw or f3 and replace it

The lock switch

Full-size SD cards have a small slider on the left edge. Down, towards the label end, is locked; up towards the metal contacts is unlocked. microSD cards have no switch, but the full-size adapter does, and it can slide as you push it into a reader. Some laptop card readers misread the switch too: if the card works in a USB card reader or another computer, the laptop's reader is the problem, not the card. A few USB sticks have a lock switch on the side.

Clear the read-only flag (Windows)

Open Command Prompt as administrator and run:

diskpart
list disk
select disk 2          (the number of the stick: check the size!)
attributes disk
attributes disk clear readonly
exit

If attributes disk showed "Current Read-only State: Yes" and clearing it works, try copying a file again. If it's back to read-only after unplugging and replugging, the stick itself is reporting read-only, which points at the switch or worn-out flash. There's also a per-partition flag: list volume, select volume N, attributes volume clear readonly.

Settings that block writing

Mac and Linux

When the flash has worn out

Flash memory can only be rewritten a limited number of times. When a USB stick or SD card runs out of spare blocks, many controllers switch to permanent read-only on purpose, so you can still rescue what's on it. Dashcams, security cameras and anything that records all day wear cards out fastest. Signs: read-only on every computer, formatting fails or "finishes" without changing anything, and deleted files come back after replugging. No setting fixes this. Copy everything off now (it may stop reading later), then replace it, ideally with a "high endurance" card for cameras. Think about what was on it before throwing it away: a read-only card can't be wiped, so destroy it physically if it held anything private.

Formatting tools

For a card that isn't write-protected but won't format properly, the SD Association's free SD Card Formatter resets it to the standard layout. Formatting can't help a card that has locked itself read-only. For picking a format afterwards, see which format to use.

Related

Test for a fake-capacity stick or card · USB stick not showing up · SD card not detected · Drive read-only on a Mac (NTFS) · "You need to format the disk" · Which format for a USB stick?

Questions

How do I remove write protection from a USB stick?

Check for a lock switch, then in an admin Command Prompt run diskpart, list disk, select disk N, attributes disk clear readonly. Also make sure the WriteProtect registry value under StorageDevicePolicies is 0 and no removable-storage policy is set.

Why does my SD card say it's locked?

The lock slider on the card, or on the microSD adapter, is in the down position, or the computer's card reader is misreading it. Slide it up towards the contacts, or try a USB card reader.

Can a write-protected USB stick be formatted?

Only once the protection is removed. If the stick has locked itself read-only because the flash is worn out, formatting fails or seems to finish without changing anything, and it needs replacing.

Why did my SD card suddenly become read-only?

Usually the memory has reached the end of its life, especially in dashcams and cameras that write constantly. The controller locks the card read-only so the files can still be copied off.

Is a read-only USB stick safe to throw away?

Not if it held private files: it can still be read, and because it can't be written to, it can't be wiped. Copy what you need, then destroy it physically.

Published · updated .

Try it

Related guides

Newest guides