Sun. Jun 23rd, 2024


Key Takeaways

  • Write protection prevents new data from being written to a storage device. It can be intentional, caused by malware, or due to encryption tools.
  • You can try toggling the lock switch on your storage device or use the DiskPart utility to disable the read-only attribute and clear the write protection.
  • Advanced users can use the Registry Editor to remove write protection by creating a DWORD entry and modifying its value data to disable write protection. If all else fails, formatting the drive may be necessary.


Did you get a “disk is write protected” error when trying to copy files or format your drive? This can be a troublesome issue. So what’s causing it, and how do you remove this error? Today we’ll find out.


What Is the Write Protect Error and What Causes It?

Write protection configures a drive such to prevent any new data from being written to it. The write protection error appears when you try to copy or modify the contents of a storage device that is write protected. The error can be caused caused by a number of things. It may be intentional, as the owner might have enabled the read-only feature of the device to secure its contents. It may also be caused by malware (namely ransomware) or inadvertently with encryption tools.

Whatever the reason is, don’t immediately resort to formatting your storage devices. Write-protection can be usually fixed in a variety of ways.

Use the Storage Device’s Lock Switch to Fix a Write Protect Error

Some storage devices have a lock switch that can be toggled to enable or disable the write protection feature. The first thing you’ll need to do when you encounter an error that says your drive is write-protected is to examine your drive physically if it has a lock switch.

If it does, simply toggle it and re-insert your drive to the appropriate port. This should solve the write-protected issue. If the problem persists, or your drive does not have the physical write-protect switch, proceed to the next method.

Disable Read-Only Using the DiskPart Utility

You can use the DiskPart utility of Windows to unlock your storage device. This method requires cmd scripting, but don’t worry — if you’re not familiar with advanced cmd scripts because you’ll be guided along the process. In this example, we’ll use DiskPart to remove write protection from a USB drive, but the process holds for any kind of write-protected device.

To begin, ensure that your computer detects the storage device that you intend to fix. Insert your device into its appropriate port and check whether your computer recognizes it through the File Explorer. In the example below, a write-protected flash drive named “USB Drive (G:)” is inserted into a computer.

Using diskpart utility of Windows to unlock your storage device

If you have a lot of storage partitions, you can take note of the memory of your storage device to help you later on for easy identification. In our case above, the flash drive’s memory is at least 14GB.

Upon confirming your storage device, you need to run the diskpart tool. This tool is a built-in Windows program so you don’t need to install it. You can simply open it through the Run command.

Open the Run program by pressing Windows+R. When the Windows Run box appears, type “diskpart” and hit the Enter key.

Once you run diskpart, you will see the diskpart utility window:

The diskpart utility window

Type the command list disk in the DiskPart utility and hit Enter. This command will display all available storage devices in your computer. Below, you’ll see that the computer has two mounted disks — “Disk 0” ,which is the hard drive, and “Disk 1,” which is the flash drive that was inserted earlier.

Type "list disk" after the word DISKPART and press Enter

From the list of disks, you’ll notice the assigned number of your storage device. You will need this property to select your device. On the next command line, type in select disk [disk number]. In the case below, disk 1 is the device that needs to be selected.

Type "select disk [disk number]" or the device needed to be selected

Press the Enter key and you’ll notice the diskpart utility informs you that the disk is now selected.

Press enter and utility will inform you that the disk is now selected

Although you can skip this step, it’s a good practice to view the attributes of your selected disk to view the overall status of your storage device. From the command line, type the command attributes disk . Be guided by the example below.

Type "attributes disk"

Immediately after typing the command, hit the Enter key to display all the attributes of your selected disk. Notice that in the example below, the attribute Read-only is set to “Yes”.

Press Enter and it will display all the attributes of your selected disk

When a disk’s Read-only attribute is configured to Yes, it means that it doesn’t allow modifications on the device. If your disk is configured this way, then your storage device is write-protected.

The last thing you should do is to clear your disk’s Read-only attribute. Clearing it means toggling the state to “No” so that the write protection gets disabled. To achieve this, enter in the command:

 attributes disk clear readonly 
Type "attributes disk clear readonly" and press Enter

You’ll be notified that the attribute has been successfully cleared. Try running the attributes disk command again and you’ll see that the Read-only attribute is now set to “No”.

Type "attributes disk" again and Enter and the attribute will set to No

Once done, you can exit the diskpart utility using the command exit . You should now be able to copy files and make changes to your storage device without the “Disk is write protected” error.

Remove Write Protection Using the Registry Editor

For advanced users, the Registry Editor is the ultimate tool in removing the write-protection on storage devices.

As always, be careful when editing the Windows Registry. Editing, deleting, or creating keys can cause errors if done incorrectly. Be sure to follow our example closely.

Once your storage device has been plugged in, launch the Registry Editor. The most straightforward way of opening this tool is through the Run command. Press the Windows+R hotkeys to display the Windows Run box, then type “regedit” and hit Enter.

You should now see the Registry Editor window on your screen.

You will see the Registry Editor window

On the left panel of the Registry Editor, navigate to the path “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control”. Confirm if a “StorageDevicePolicies” folder exists. If it does, then you can skip the folder creation process and proceed with the DWORD creation. Otherwise, you’ll need to manually create the folder.

Right-click on the folder named “Control”. Hover your mouse pointer to “New” and select “Key”.

Right click the "Control" folder and hover your mouse on the "New" option and press "Key"

Upon creating a new folder or key, rename it to “StorageDevicePolicies”.

Create a new folder with a name of "StorageDevicePolicies"

For the “StorageDevicePolicies” to work, you should create a DWORD entry named “WriteProtect”. Select the “StorageDevicePolicies” folder, and right-click on its left panel to display the context menu. Move your mouse pointer over “New” and click “DWORD (32-bit) Value” option.

Select the "StorageDevicePolicies" folder, and right-click on its left panel and hover you mouse to "New" and select "DWORD"

Rename the new DWORD entry as “WriteProtect” like the example below.

Rename the file DWORD to "WriteProtect"

Now that we have the “WriteProtect” entry, we need to modify its value data to “0”. Doing this lets you disable the write protection of your storage device. To achieve this, double click the “WriteProtect” entry and change its value to “0” if it’s not yet in this state.

To complete the process, reboot your computer and confirm if the write protection has been removed from your storage device.

The worst case that you might encounter is when you’ve tried all the methods already but the write protection problem still persists. In this case, you may want to look into the possibility of formatting your drive.



Source link

By John P.

Leave a Reply

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