sodcalculator

10 Tech How-To

How to Fix a Write-Protected USB Drive

Guide 10-4823 · Updated · Step by step

If your USB drive suddenly refuses to copy, delete, or format files with a “disk is write-protected� error, the drive’s read-only switch or a software setting is blocking writes. This guide walks you through the most common fixes, from checking the physical lock switch to clearing the read-only attribute in Diskpart, and helps you get your drive back to normal.

What You’ll Need

  • Your USB drive
  • A computer with a USB port (Windows recommended for most fixes)
  • Administrator access on that computer (to run Command Prompt or Diskpart)
  • Optional: a different USB port or another computer to test the drive

Step-by-Step

  1. Check the physical lock switch. Many USB drives have a small switch on the side that toggles between “lock� and “unlock.� Slide it to the unlock position. If the switch is loose or broken, try holding it in the unlock position while inserting the drive.
  2. Try a different USB port or computer. Plug the drive into another port (preferably on the back of a desktop) or another computer. If it works there, the issue is with your port or system, not the drive.
  3. Run a quick disk check. Open File Explorer, right-click the drive, select Properties > Tools > Check. This can fix file system errors that sometimes cause write-protection.
  4. Clear the read-only attribute using Diskpart (Windows). This is the most effective software fix. Press Windows + R, type diskpart, and press Enter. In the Diskpart window, type the following commands one by one, pressing Enter after each:
    • list disk – note the disk number of your USB drive (e.g., Disk 2).
    • select disk 2 – replace “2â€� with your drive’s number.
    • attributes disk clear readonly – this removes the read-only flag.
    • exit

    Unplug the drive, wait a few seconds, then reconnect it. Try writing a file to it.

  5. Use Registry Editor (Windows) if Diskpart fails. Press Windows + R, type regedit, and press Enter. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. If the StorageDevicePolicies key doesn’t exist, right-click Control and create a new Key named StorageDevicePolicies. Inside it, create a new DWORD (32-bit) value named WriteProtect and set its value to 0. Restart your computer and try the drive again.
  6. Format the drive (last resort). If the drive is still write-protected but you can access it, back up any important data (you can read files even when write-protected), then right-click the drive in File Explorer and select Format. Choose a file system like exFAT for compatibility, and check “Quick Format.� This will erase all data but may clear the protection.
  7. Try a third-party formatting tool. If Windows formatting fails, tools like HP USB Disk Storage Format Tool or Rufus (for creating bootable drives) sometimes can format drives that Windows can’t. Use them with caution, as they may overwrite the drive’s firmware.

Common Mistakes

  • Using the wrong disk number in Diskpart. Selecting the wrong disk can clear attributes on your internal hard drive, causing data loss. Double-check the disk number and size before proceeding.
  • Forgetting to back up data before formatting. Formatting erases everything. Always copy off important files first.
  • Assuming the switch is the only cause. Even if the switch is unlocked, the drive can still be write-protected due to software settings or file system corruption.
  • Skipping the registry fix. If Diskpart doesn’t work, the registry may be enforcing write protection at the system level. Don’t skip this step.

Tips

  • Always eject the USB drive properly before removing it to prevent file system corruption that can trigger write protection.
  • If the drive is old or has been dropped, the physical switch may be damaged. A broken switch can permanently lock the drive – in that case, consider replacing it.
  • Some drives have a firmware-level write protection that cannot be removed by software. If all steps fail, the drive may be dead or intentionally locked by the manufacturer.
  • Keep your USB drives virus-free by scanning them regularly; some malware sets the read-only attribute to prevent removal.

Troubleshooting

If the steps above don’t work, try these additional checks:

  • Check if the drive is physically damaged. Look for bent pins, cracks, or a loose connector. A damaged drive may not respond to software fixes.
  • Try a different operating system. If you have access to a Mac or Linux computer, connect the drive there. If it works, the issue is specific to your Windows setup.
  • Use the “cleanâ€� command in Diskpart. As a last resort, type clean in Diskpart after selecting the disk. This wipes the entire drive, including partitions, and may remove stubborn write protection. Then create a new partition with create partition primary and format it.
  • Check for manufacturer utilities. Some USB drive manufacturers (like SanDisk, Kingston) provide repair tools that can reset the drive’s firmware. Visit their official support pages for specific software.
  • Test the drive on another computer with a different OS. If it works on a Mac but not on Windows, the problem might be with Windows’ USB drivers. Update your chipset drivers or try a different USB port.

Frequently Asked Questions

Why is my USB drive write-protected even though the switch is unlocked?

Software settings, file system corruption, or a damaged drive can cause write protection regardless of the physical switch. The Diskpart and registry fixes above address these causes.

Will formatting remove write protection?

Sometimes yes, but not always. If the protection is due to a file system error, formatting can clear it. If it’s a hardware or firmware issue, formatting won’t help.

Can I recover data from a write-protected USB drive?

Yes, you can usually read and copy files from a write-protected drive. The protection only blocks writes. Use File Explorer to copy files to your computer before attempting any fixes.

Is it safe to use Diskpart?

Diskpart is safe if you select the correct disk. Always verify the disk number and size before running clean or attributes disk clear readonly. Incorrect selection can wipe your hard drive.

My USB drive is write-protected after using it on a printer or camera. Why?

Some devices (like cameras) set a read-only flag on the drive to protect their files. Use Diskpart to clear the attribute, and it should become writable again.

What if none of the steps work?

If the drive remains write-protected after all software fixes, it’s likely a hardware failure. The drive may be at the end of its lifespan, and it’s best to replace it.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →