Skip to content
Essential Data Recovery

The disk is write protected: how to fix it

A write-protected drive refuses every write: saves, deletes, renames, and formats all fail. Work through the checks in order: the card's lock switch, another port and computer, Windows write policies, then diskpart to clear a read-only flag. If the drive still refuses writes at the end of that list, it has probably locked itself to protect failing flash, so copy your files off while it still reads and replace it.

Written by Essential Data RecoveryPublished 2026-09-13Owner-reviewedRevision 1
A small SD memory card with its side lock switch visible resting on an open blank paper notebook on pale oak wood

"The disk is write protected" means the drive refuses every write: saves, deletes, renames, and formats all fail. Some causes are trivial: a memory card's lock switch does it. Some are Windows policy. And some are the drive protecting itself: SanDisk documents that a flash drive which detects a potential fault inside itself goes into write-protected mode to prevent data loss. That last possibility is why this guide starts with copying your files off, not with fixing. A write-protected drive usually still reads, so get your files somewhere safe before you change anything.[1]

First: get your files off the drive

Write protection leaves the drive readable, and reading from flash does not use up its cells in any way that matters here; repeated writing is what wears flash out. SanDisk's own write-protection article ends by telling readers to back up their data and request a replacement, and that is the right order even when a fix is still possible: fixes get tried on a copy of the data, never on the only copy. Copying from the drive writes nothing to it, so this step has nothing to lose.[2][1]

Copy the drive while it still opens

  1. Connect the drive and let it appear in File Explorer, or Finder on a Mac.
  2. Select the folders you care about and copy them to the computer's drive or a second drive.
  3. Open two or three of the copied files to confirm they came across intact.
  4. Do not delete, cut, rename, or reorganize anything on the source drive while you are at it.
  5. If the drive will not open at all, stop: that is a different problem, and its guide is linked at the end of this page.
[1]

Step 1: check the physical lock switch

Full-size SD cards have a small Lock switch on their left edge. Slide it down and the card reports write protected in every device, with no error anywhere in the operating system offering to clear it; slide it back up and writes work again. If you are using a microSD card in a full-size SD adapter, the switch that matters is on the adapter card, not on the microSD card. USB sticks are a different story: a few models have a write-protect switch on the case, but most never did, so a stick with no switch is normal and the cause is somewhere below.[3][2][4]

Rule the switch in or out

  1. Pull the card out and look at its left edge for a small sliding switch.
  2. Slide it toward the contacts, away from the Lock marking, and reinsert the card.
  3. Try one write: copy a small file onto the card.
  4. With a microSD card, take it out of the adapter and check the adapter's own switch instead.
  5. If the switch slides too easily, the card slot may be knocking it to locked as the card goes in; SanDisk's guidance is that the card needs replacing at that point.
  6. If the switch is up and firm and the card still reports write protected, the switch is not the cause. Go to Step 2.
[3][4]

Step 2: rule out the computer

Before blaming the drive, make sure the drive is the thing refusing writes. SanDisk's own troubleshooting asks you to try another port on the same computer and then another computer if you can, precisely to separate a failing drive from a blocking PC. Two software causes also live on the computer side: the Windows removable-disk write policy covered in Step 3, and, on a work machine, an IT department that blocks saving files to removable drives.[1]

Isolate the drive from the PC

  1. Move the drive to a different USB port on the same computer and try one small copy.
  2. If it still refuses writes, try it in another computer.
  3. If it writes normally elsewhere, the drive is fine and the first computer's settings are the cause; Step 3 is the place to look.
  4. On a work or school computer, ask IT before changing anything: a block on saving to removable drives is deliberate, and you probably cannot lift it yourself.
  5. If the drive refuses writes on every computer, stop tweaking the computers and go to Step 3.
[1]

Step 3: check for a Windows write block

Windows can make every removable disk read-only through a policy called Removable Disks: Deny write access. Microsoft documents it under the RemovableStorageDevices policy key (Computer Configuration > System > Removable Storage Access), set by device management or Group Policy rather than by Windows on its own, so on a personal PC nobody manages it is an unlikely cause. One honest caveat: the registry edit most often shared as a fix for this error, creating a StorageDevicePolicies key with a WriteProtect value, is not something we could verify against Microsoft's documentation for this symptom. The write block Microsoft does document is the policy above.[5]

What to do about a policy block

  1. On a personal PC that no employer or school manages, treat a policy block as unlikely and move on to Step 4.
  2. On a work or school computer, ask IT whether writes to removable disks are blocked. If they are, only IT can change it.
  3. Do not edit policy registry keys on a managed computer to get around a block your organization set.
[5][1]

Step 4: clear the read-only flag with diskpart

Windows also keeps a per-disk read-only attribute, and diskpart can clear it. The command is attributes disk: set turns the read-only flag on, clear turns it off, and diskpart requires that a disk be selected first, so you will point it at your drive by number before clearing anything.[6]

Nothing in this guide erases data, and nothing here should. Do not format the drive while your files exist only on it, and do not run diskpart's clean command. A format is a series of writes, and a write-protected drive refuses writes, so an aggressive format cannot succeed; it only costs time and, on a drive that may be failing, what life it has left. If diskpart's clear does not lift the protection, that result is information, not a reason to escalate.[1]

Clear the read-only attribute

  1. Close any windows or programs that are using the drive.
  2. Open Command Prompt as administrator: search for cmd, right-click it, and choose Run as administrator.
  3. Type diskpart and press Enter, then approve the permission prompt.
  4. Type list disk and press Enter. Find your drive in the list and note its disk number, checking the size column; selecting the wrong disk is the one real risk here.
  5. Type select disk 1, using your drive's number, and press Enter.
  6. Type attributes disk clear readonly and press Enter.
  7. Type exit to leave diskpart, then try copying one small file to the drive.
  8. If the copy still fails, do not move on to format or clean. Go to the stop section below.
[1][6]

Why you cannot format it

A format writes to the disk: it lays down a fresh file system, which means changing the very structures the protection is refusing to let change. That is why the write-protected error appears no matter which tool you try to format with, and why the usual escalation, a second formatting program or a lower-level one, produces the same message. The failed format is not a separate fault to solve; it is the same refusal, seen from a different command.[1]

A read-only drive is not always write protected

One neighboring symptom is worth separating. A drive can be read-only because of the state of the file system on it, with no switch, policy, or fault involved. The ntfs-3g driver, which reads and writes Windows NTFS volumes from Linux and macOS, documents that it forces a read-only mount when Windows is hibernated or its fast restart is enabled, denies a read-write mount on a hibernated NTFS volume, and notes its read-only option is useful when the NTFS journal is unclean. If your drive opens and copies fine but quietly refuses changes, and it was last in a Windows PC that hibernated, the file system's state is a likelier suspect than the controller.[7]

When to stop fixing and replace the drive

Work through the switch, another port and another computer, the policy check, and diskpart, in that order. If the drive still refuses writes at the end of that list, you are almost certainly looking at the self-protecting drive, and SanDisk states plainly that there is no method to fix it. Flash near the end of its life gets locked this way too, which is why a drive that was always fine can refuse writes one day without warning. SanDisk's articles on this error end the same way: back up your data and request a replacement. Copy everything off while the drive still reads, claim warranty or replace the device, and stop there.[1][2][3]

Related reading

External drive detected but inaccessible

Windows RAW drive recovery

Can a corrupted SD card be fixed?

How long do USB sticks and SD cards last?

Not sure which situation you are in? Try guided help

Sources

Facts on this page are cited to the publishers’ own documentation.

  1. [1] SanDisk (Western Digital), retired knowledge base, via Wayback MachineWrite Protect Error on USB Flash Drives (SanDisk KB Answer ID 8656). captured 2026-09-13.
  2. [2] WikipediaUSB flash drive. captured 2026-09-13.
  3. [3] SanDisk (Western Digital), retired knowledge base, via Wayback MachineSD/SDHC/SDXC memory card is write protected or locked (SanDisk KB Answer ID 1102). captured 2026-09-13.
  4. [4] SanDisk (Western Digital), retired knowledge base, via Wayback MachineSanDisk microSD memory card is write protected or locked (SanDisk KB Answer ID 6971). captured 2026-09-13.
  5. [5] Microsoft LearnStorage Policy CSP (RemovableDiskDenyWriteAccess). captured 2026-09-13.
  6. [6] Microsoft Learnattributes disk (diskpart command reference). captured 2026-09-13.
  7. [7] ntfs-3g project (Tuxera), Debian manpages editionntfs-3g(8) Linux man page. captured 2026-09-13.