Fix the disk is write protected error on a flash drive
Solved Email & Outlook
AJ
Andrew Jackson
January 20, 2020
2 replies
13,680 views
Reviewed by moderators

My USB flash drive suddenly gives the disk is write protected error, I cannot copy to it, delete from it or format it. No physical switch that I can see.

What causes write protection with no switch and how do I clear it?

Accepted Answer
Verified by Kerry Morris, Forum Moderator ยท Reviewed January 2020

Write protection with no physical switch is set in software or signals a drive protecting itself, so the fixes run from software toggles to the harder truth, in order:

1
Check for a physical switch anyway, since some are subtle: slide any small switch on the drive body to the other position, as a lock switch in the locked position is the simplest cause and easy to miss on the edge of the casing.
2
Clear the registry write protect policy: some systems have a StorageDevicePolicies registry key setting write protection, at HKLM\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies, a WriteProtect value of 1 enabling it, set to 0 to disable, then reconnect the drive. This clears write protection that a policy or a program set system wide.
3
Clear it with diskpart, the reliable software route: open an admin command prompt, diskpart, list disk, select disk N being your flash drive by size, then attributes disk clear readonly, which removes a readonly attribute set on the disk. This is the command that fixes most no switch write protection, the drive marked readonly in software.
4
Try a format if the drive is now writable but you want it clean: once write protection clears, format normally or if diskpart still refuses, clean followed by creating a new partition and formatting rebuilds the drive, erasing it, appropriate when the data is already lost or backed up.

The harder truth when nothing clears it: a flash drive that refuses all write protection removal, resists diskpart and cannot be formatted is often failing, since flash memory that reaches its wear limit or detects errors switches itself to read only permanently to protect the remaining data, a genuine hardware end state rather than a software setting. This is the drive telling you it is dying, and the right response is recovering the data off it while it can still be read, since read only means readable, then retiring the drive, the write protection that will not clear being a symptom rather than a problem to solve.

diskpart attributes disk clear readonly did it, the drive had somehow got the readonly attribute set and clearing it restored writing immediately. Formatted it clean afterward. Glad it was the software cause and not the dying drive end state you described, though I backed up its contents first just in case per that warning.