TechBuzzPro

Remove the Read‑Only State from a USB Drive

· 6 min read · Windows & PC

In this article
  1. What You’ll Need
  2. Step‑By‑Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can clear the read‑only flag on a USB flash drive using built‑in tools in Windows, macOS, or Linux; the process involves changing the drive’s attribute with a command‑line utility or, on Windows, with Diskpart.

What You’ll Need

  • A computer running Windows 10/11, macOS 10.15 or later, or a modern Linux distribution.
  • The USB drive that is currently read‑only.
  • Administrator or root privileges on the computer.
  • Basic comfort with command‑line interfaces (cmd, PowerShell, Terminal).

Step‑By‑Step

  1. Back up any data you still need. Removing the read‑only attribute does not delete files, but if the drive is failing, a backup protects you from accidental loss.
  2. Identify the drive letter (Windows) or device node (macOS/Linux).
    • Windows: Open File Explorer, locate the USB drive, and note its letter (e.g., E:).
    • macOS: Open Terminal and run diskutil list. Find the entry that matches the size and name of your USB; note the identifier such as /dev/disk2.
    • Linux: Open a terminal and run lsblk or fdisk -l. Look for a device like /dev/sdb with the correct size.
  3. Open an elevated command prompt.
    • Windows: Click Start, type cmd, right‑click Command Prompt and choose Run as administrator.
    • macOS/Linux: Open Terminal. Use sudo -i (or prefix commands with sudo) to gain root privileges.
  4. Use the appropriate tool to clear the attribute.
    • Windows – Diskpart
      1. Type diskpart and press Enter.
      2. At the DISKPART> prompt, type list volume and press Enter. Locate the volume number that matches your USB drive.
      3. Select the volume: select volume X (replace X with the number you found).
      4. Remove the read‑only flag: attributes volume clear readonly. Diskpart will confirm the change.
      5. Type exit twice to leave Diskpart and the command prompt.
    • macOS – Disk Utility (GUI) or Terminal
      1. Open Disk Utility (found in Applications > Utilities).
      2. Select the USB drive in the sidebar, click the Info button, and verify that the "Read‑Only" checkbox is unchecked. If it is checked and cannot be changed, proceed to Terminal.
      3. In Terminal, run diskutil info /dev/diskN (replace N with your identifier) to confirm the current Read‑Only status.
      4. Clear the flag with diskutil unmountDisk /dev/diskN followed by diskutil eraseDisk FAT32 TEMP MBRFormat /dev/diskN. This command formats the drive, which also removes the read‑only attribute. If you do not want to erase, use sudo mount -uw /dev/diskN to remount it as writable.
    • Linux – hdparm or blockdev
      1. First, ensure the drive is not mounted: sudo umount /dev/sdX* (replace X with the appropriate letter).
      2. Check the current flag: sudo hdparm -r /dev/sdX. If it returns readonly = 1, the flag is set.
      3. Clear the flag: sudo hdparm -r0 /dev/sdX. This sets the drive to read‑write mode.
      4. If hdparm reports that the device does not support the command, try sudo blockdev --setrw /dev/sdX instead.
  5. Verify the change.
    • Windows: In File Explorer, try creating a new folder or copying a file onto the USB drive. If it succeeds, the flag is cleared.
    • macOS: Run diskutil info /dev/diskN again; the Read‑Only line should show No. Then drag a file onto the drive.
    • Linux: Use touch /media/usb/testfile (adjust the mount point) to confirm write access.
  6. Safely eject the drive. Use the OS‑provided eject command (Safely Remove Hardware on Windows, right‑click and choose Eject on macOS, or udisksctl unmount -b /dev/sdX on Linux) before unplugging.

Common Mistakes

Attempting to clear the flag on a drive that is physically write‑protected (a hardware switch) will never succeed; the software commands only affect logical attributes. Selecting the wrong volume or device node can lead to data loss on an internal drive, so double‑check the identifier before issuing any command that modifies attributes. On Windows, forgetting to run the command prompt as administrator will cause Diskpart to report “Access denied.” On macOS and Linux, omitting sudo will result in “operation not permitted.” Finally, using the eraseDisk command in macOS without intending to format will permanently delete all data.

Tips

  • Keep a small text file on the USB drive as a quick test for write permission after each change.
  • If the drive repeatedly reverts to read‑only after a reboot, the flash memory may be failing; consider replacing the drive.
  • When using hdparm on Linux, add the -v flag for verbose output to see exactly what the tool is doing.
  • On Windows, you can also clear the flag via the registry if Diskpart fails: navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies and set WriteProtect to 0. Restart after editing.
  • Always eject the drive properly; abrupt removal can cause the controller to flag the device as read‑only on the next insertion.

Troubleshooting

Step 1 – Confirm the drive is not physically locked. Some USB sticks have a tiny switch on the side. If it is set to “Lock,” software cannot override it.

Step 2 – Re‑run the attribute command. A typo or an interrupted session can leave the flag unchanged. Close the terminal, reopen it with elevated rights, and repeat the appropriate command.

Step 3 – Check for driver or firmware issues. On Windows, open Device Manager, expand Disk drives, right‑click the USB device, and select Update driver. On macOS, ensure the system is up to date; firmware updates sometimes resolve controller bugs.

Step 4 – Use a different computer. If the same USB remains read‑only on multiple machines, the issue is likely hardware‑level.

Step 5 – Re‑format as a last resort. Formatting will definitely remove the read‑only flag because it rewrites the file‑system structures. In Windows, right‑click the drive → Format…. Choose NTFS or exFAT depending on your needs. On macOS, use Disk Utility → Erase. On Linux, mkfs.vfat /dev/sdX1 (or another file system) will do the job.

If none of the above resolves the problem, the flash controller may have entered a permanent read‑only mode due to wear‑leveling failures. In that case, replace the drive.

Frequently Asked Questions

Why does my USB drive become read‑only after a power loss?

Sudden power loss can trigger the drive’s firmware to protect data by switching to a read‑only mode. Running the attribute‑clearing commands after the next boot usually restores write access.

Can I remove the read‑only flag without losing any files?

Yes. The commands listed (Diskpart, hdparm, diskutil) modify only the attribute; they do not format or delete data. Only formatting will erase files.

Is the read‑only attribute the same as the “write protection” switch?

No. The hardware switch physically disables the write circuit, while the attribute is a software flag stored in the drive’s controller. Both prevent writing, but only the software flag can be changed via commands.

My drive still shows as read‑only after using Diskpart. What now?

Double‑check that you selected the correct volume number. If the correct volume is selected and the command succeeded, try unplugging and re‑plugging the drive. If the problem persists, test the drive on another computer or consider that the flash memory may be failing.

Do these steps work on USB‑C external SSDs?

The same principles apply to any USB mass‑storage device, including external SSDs, as long as the operating system recognizes it as a standard disk.

Will disabling write protection affect the data already on the drive?

No. Existing files remain unchanged; you simply regain the ability to modify, add, or delete files after the flag is cleared.