The Disk Is Write Protected? How to Fix It

Avatar photo

Why Windows says the media is locked

If Windows reports that the disk is write protected, you can usually open files but cannot copy, delete, or format them. The lock can be a physical switch on a USB stick or SD card, a read-only flag on the disk, or a policy in the registry. Hardware failure can also put some drives into a permanent read-only state.

Windows enforces that lock at more than one layer. A slider on the media is honored by the reader. DiskPart can also show a read-only attribute on the disk or on the volume. A policy value can mark all removable disks read-only. And some failing flash controllers switch themselves into a permanent read-only mode so the remaining data can still be copied off.

Do not format the drive as your first step if you need the files. The fixes below clear software locks first. Microsoft documents the DiskPart commands in attributes disk, and the Disk Management app in Disk Management in Windows.

It also helps to test the same stick on a second PC, or a known-good stick on this PC, before you assume Windows is at fault. If the disk is write protected on every computer and the slider is already unlocked, treat the media as the likely failure and copy the files off first.

A lock that appears only in one USB port, or only through a cheap hub, is usually the port or the cable, not a policy on the PC.

If a copy starts and then stops with a generic I/O error, that is not the same as a clean “write protected” message. Finish the copy of what you can, then test a known-good stick in the same port so you know whether the port or the media is next.

If File Explorer is slow to show the drive, our File Explorer slow guide can help after the lock is cleared.

Before you start

Copy any important files off the drive first, if Windows still lets you read them. A failing stick can go from read-only to unreadable.

Look for a physical lock switch on the USB stick, the SD card, or the SD adapter before you change anything in Windows. Also try another port or another PC. If every computer reports a lock and the switch is already unlocked, treat the media as suspect.

A worn slider can also sit between two positions and look unlocked while the contacts still say locked. Move it firmly both ways, then replug the card or stick before you open DiskPart.

Identify the drive by its size, not only by Disk 1 or Disk 2. DiskPart commands are powerful, and selecting the wrong disk is the main risk in this process. If two drives show a similar size, unplug the one you are not fixing, then list the disks again.

Create a restore point before you edit the registry. Press the Windows key, type Create a restore point, select the system drive, and choose Create. You do not need a restore point to move a lock slider or to run DiskPart on a removable drive, but you should be certain of the disk number.

Work through the checklist below in order. After each change, try copying a small text file to the drive.

Quick-fix checklist for a disk is write protected error on Windows 11

Use the checklist above as you work. Success is a file that copies to the drive and opens from there. If writes still fail on every PC, stop and finish the copy of your data.

Fixes when the disk is write protected

1. Check the physical lock switch

Many USB sticks and SD cards have a tiny lock slider. If it is set to lock, every PC will treat the media as read-only.

  1. Remove the stick or card safely.
  2. Look for a slider marked Lock or a padlock icon. Move it to the unlock position.
  3. Plug the drive in again and try copying a small file to it.

If there is no switch, continue. A locked SD card in an adapter can also be the cause, even when the card itself has no slider.

If the slider feels loose or slides back on its own, hold it in the unlock position and try another adapter or reader. A worn switch can keep reporting that the disk is write protected even after you think you unlocked it.

2. Use DiskPart clear readonly on the disk

The DiskPart clear readonly command removes a software read-only flag from the selected disk. Pick the right disk number carefully. Choosing the wrong disk can affect a drive you did not mean to change.

  1. Right-click Start and open Terminal (Admin).
  2. Type diskpart and press Enter.
  3. Run list disk and identify the removable disk by its size.
  4. Run select disk X, replacing X with that number.
  5. Run attributes disk clear readonly.
  6. Run attributes disk to confirm that Read-only is No, then type exit.

Try a copy again. If the command says the attributes could not be changed, the lock may be hardware-level. Go to the later checks.

Read list disk twice if you need to. The system disk is usually the largest disk and is often Disk 0, but you must match the size of the USB or SD card. After DiskPart clear readonly succeeds, attributes disk should show Read-only as No.

3. Remove write protection from the volume

If the disk flag is already clear, the volume itself may still be read-only.

  1. In the same administrator DiskPart session, run list volume.
  2. Run select volume X, using the volume number for the USB or SD card.
  3. Run attributes volume clear readonly.
  4. Type exit and test the drive again.

This is a second remove write protection step, aimed at the volume rather than the whole disk. Use it only after you have identified the correct volume by its size and letter.

If the volume letter is missing, assign one in Disk Management, then retry the copy. A volume can be healthy and still refuse writes until you remove write protection at both the disk and volume layers.

4. Clear the StorageDevicePolicies registry key

A policy value can mark all removable disks as read-only. This is less common on a home PC, but it is worth checking.

  1. Press Windows key + R, type regedit, and press Enter.
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.
  3. If you see a WriteProtect value, double-click it and set it to 0, or delete the value if you created it yourself.
  4. Restart the PC and try the drive again.

If the StorageDevicePolicies key does not exist, you do not have this policy. Do not add the key just to experiment. Only change it on a computer you own.

This StorageDevicePolicies registry key is a good explanation when every USB stick is locked, not just one. After you change WriteProtect to 0, test a known-good drive as well as the one that started the problem.

5. Test a USB write protected drive on another port

A USB write protected message can also appear when the port or cable is failing, or when Windows never mounted the drive correctly.

  1. Try a different USB port, preferably one on the back of a desktop or a port you know works with other devices.
  2. Avoid unpowered hubs for this test.
  3. If the drive uses a cable, try another cable.
  4. Test the same drive on a second PC if you have one.

If every PC reports a lock and the switch is already unlocked, the drive may have set its own hardware write-protect after a fault. If this port also throws USB errors with other devices, see our device descriptor request failed guide.

If the same USB write protected error follows the stick to another PC, the media is the problem. If it only happens on one port, the PC or the hub is the problem.

6. Check the file system and BitLocker status

A dirty file system, or a lock you set yourself, can look like write protection.

  1. Right-click the drive in File Explorer, choose Properties > Tools, and run Error checking.
  2. Open Disk Management and confirm the volume is healthy and has a drive letter.
  3. If the drive is BitLocker encrypted, unlock it with your password or key before you try to write files.
  4. If you set the folder or files to Read-only only, clear that box on the Properties page. A folder attribute is not the same as a disk-level lock, but it can look similar.

Do not run a format while you still need the data.

7. Recover files if the drive stays locked

Some failing flash drives switch to a permanent read-only mode so the remaining data can still be read. Software will not clear that kind of lock.

  1. Copy every important file off the drive to your PC now.
  2. Try the DiskPart and registry steps one more time after the copy.
  3. If writes still fail, replace the stick or card. A format may also fail on this kind of hardware.

After the files are safe, you can try a format in Disk Management as a last test. If the format fails, the drive is finished. A sluggish PC is not the usual cause, but if Explorer itself is struggling, our how to speed up Windows 11 guide is a separate issue.

How to prevent it from coming back

Eject USB drives and SD cards with Safely Remove Hardware before you pull them out. An unsafe removal can leave a dirty file system that later looks like a lock.

Store SD cards in a case so the adapter slider cannot slide itself during travel. A card that arrives locked after a bag trip is more often the slider than a Windows policy.

Keep a spare known-good stick so you can tell a media fault from a Windows policy. If every removable disk is suddenly locked, check the StorageDevicePolicies registry key before you throw away the drives.

Do not use random “write protection remover” tools. DiskPart, Disk Management, and the official policy key are the supported software paths. If a stick keeps locking itself after a successful clear, replace it.

Ejecting cleanly also reduces the chance of a dirty file system that later looks like a lock. If usb write protected warnings start after one unsafe removal, run a disk check on a copy of your files, then test a small write again.

Keep a short note of whether you had to use diskpart clear readonly, or whether you only moved a slider. That record saves time if the same stick comes back locked after a trip.

Deeper repair options

Use these when the disk is write protected on more than one drive, or when DiskPart cannot change attributes on a volume that still looks healthy.

A clean boot can help if a security or USB filter tool is forcing removable media read-only. Press Windows key + R, type msconfig, hide all Microsoft services, disable the rest, and restart. Then replug the drive and try a copy.

Event Viewer can show a failing device. Check Windows Logs > System for disk, usbstor, or ntfs errors when you plug the drive in. Repeated surprises on one stick, plus a USB write protected message on every PC, usually mean the controller has entered a hardware lock.

System file repairs and an in-place Windows 11 repair are only for the rare case where every removable disk is locked on this PC and the policy key is already clear. They will not unlock a failing flash drive. Copy the files off first.

If only one stick is locked after those software checks, stop changing Windows and finish the copy. A hardware lock will not clear from DISM, SFC, or a repair install. Replace the stick once the files are safe.

If a cheap card reader is in the path, test the same SD card in another reader. Some readers report a lock when the adapter itself is cheap or worn, even though the card is fine in a laptop slot.

Quick reference

What you seeTry this first
A slider on the stick or SD adapterMove it to unlock and replug (Fix 1)
The error appears on a stick with no switchClear the disk and volume read-only flags (Fixes 2 and 3)
Every removable drive is lockedCheck the StorageDevicePolicies value (Fix 4)
Only one port or hub failsTry another port or cable (Fix 5)
Writes fail on every PCCopy files off, then replace the drive (Fix 7)
Attributes cannot be changedTreat it as a hardware lock and recover files (Fix 7)

FAQ

Will DiskPart delete my files?

The attributes disk clear readonly command changes a flag. It does not format the disk. You still must select the correct disk number, so read list disk carefully before you continue. DiskPart clear readonly is a flag change, not a wipe.

Why does the lock come back after I clear it?

A physical switch, a policy, or a failing drive can reapply the flag. If the command succeeds and the lock returns immediately, treat the drive as failing and copy the files off. If every drive locks again, go back to the StorageDevicePolicies registry key.

Can I format a write-protected disk?

Not until the lock is cleared. Format will fail while the flag is on. If you do not need the data and DiskPart cannot clear the flag, the hardware is likely at the end of its life. Never format as your first step if you still need the files.

Does this fix also work for an internal drive?

The same DiskPart commands work on internal disks, but the risk of selecting the wrong disk is higher. Use them only when you are sure of the disk number. To remove write protection on a removable disk, match the size in list disk first.

What if StorageDevicePolicies is missing?

That is normal. The key appears when a policy has been set. Do not create it unless you are following a specific, trusted policy guide on a PC you administer. A missing StorageDevicePolicies registry key means this policy is not the cause.

The switch is unlocked, but every PC still says the disk is locked. Now what?

Copy the files off while you still can. A USB write protected state that follows the media is often a hardware protect mode. Software steps are worth one more try, but do not wait to recover the data.

Is a folder Read-only box the same as a write-protected disk?

No. A folder or file attribute is smaller in scope and is cleared on the Properties page. A disk-level lock blocks new files anywhere on the volume. If only one folder refuses writes, start there before you run DiskPart.

Sources

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
WiFi Option Missing on a Windows 11 laptop in a home office

Wi-Fi Option Missing in Windows 11? How to Get It Back

Next Post

Plugged In Not Charging on Windows 11? 8 Easy Fixes

Related Posts