Did you get a “hard drive is write protected” error message while trying to copy files or format your drive? This can be an annoying problem. What is the cause and how can you fix this error? Today we’re going to find out.
table of contents
- What is the write protection error?
- Toggle the lock switch
- Use the DiskPart utility
- Use the registry editor
The write protection error appears when you try to copy or change the contents of a write-protected storage device. This error is caused by a number of reasons. This may be by design as the owner may have enabled the device’s read-only functionality to secure its contents. It can also be caused by viruses or encryption tools.
Whatever the reason, don’t resort to formatting your storage devices right away. Write protection can be easily repaired in a number of ways.
Some storage devices have a lock switch that can be toggled to enable or disable the write protection function. The first thing to do when you encounter an error that says your drive is write protected is to physically check your drive to see if it has a lock switch.
If it does, just toggle it and plug your drive back into the appropriate port. This should solve the write protection problem. If the problem persists or your drive does not have the physical write-protect switch, move on to the next method.
Which file system should I use for my USB drive?
You can use Windows’ DiskPart utility to unlock your storage device. This method requires cmd scripting, but if you are unfamiliar with advanced cmd scripts, don’t worry as it will walk you through the process. Just follow the steps below.
First of all, make sure that your computer recognizes the storage device that you want to repair. Plug your device into the appropriate port and see if your computer recognizes it through File Explorer. By doing example below, a write-protected flash drive called “USB Drive (G :)” is inserted into a computer.
If you have a lot of storage partitions, you can write down the storage of your storage device for easy identification later. In our case above, the flash drive’s memory is at least 14 GB.
After 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 easily open it using the Run command. Open the Run program by pressing Windows + R. When the Windows run box appears, type “diskpart” and click Enter Key.
Once you’ve followed the steps above, you should see the diskpart utility window like this:
Enter the command in the diskpart utility
list disk and strike immediately Enter. This command will display all of the available storage devices in your computer. Below you can see that the computer has two drives mounted – Disk 0 which is the hard drive and Disk 1 which is the flash drive previously inserted.
In the list of data carriers you can see the assigned number of your storage device. You need this property to select your device. On the next command line, enter
select disk [disk number] . In the following case, Disk 1 is the device that needs to be selected.
Press the Enter Button and you will find that the diskpart utility will inform you that the disk is now selected.
Although you can skip this step, it is recommended that you view the attributes of your selected disk to see the overall status of your storage device. Enter the command in the command line
attributes disk . Let yourself be carried away by the example under.
Immediately after entering the command, press the Enter Button to display all the attributes of your selected disk. Note that in the example below, the Read-only attribute is set to “Yes”.
If the write protection attribute of a data carrier is configured to Yes, it means that no changes are allowed on the device. If your hard drive is configured this way, your storage device is write-protected.
The last thing you should do is clear your hard drive’s read-only attribute. Deleting means switching the status to “No” so that the write protection is deactivated. To do this, enter the command
attributes disk clear readonly and run the command.
You will be notified that the attribute was successfully deleted. Try to do it
attributes disk Command again and you will see that the Read-only attribute is now 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 getting a “Hard drive is write protected” error.
For advanced users, Registry Editor is the ultimate tool for removing the read-only error in storage devices. This technique is not recommended if you are new to it as it may mess up other system registries. However, if you run out of options, we’ve simplified the steps for you.
After your storage device is connected, start the registry editor. The easiest way to open this tool is with the Run command. Press the Windows + R keyboard shortcut to display the Windows run box. Enter “regedit” here and press Enter.
You should now see the Registry Editor window on your screen.
In the left pane of the Registry Editor, navigate to the path
Confirm here whether a “StorageDevicePolicies” folder is available. If so, you can skip the rest of this guide and move on to the next step. Otherwise you will have to create the folder manually.
Right click on the folder named “Control”. Move your mouse pointer to “New” and select “Key”.
If you create a new folder or key, rename it to “StorageDevicePolicies”.
In order for the “StorageDevicePolicies” to work, you should create a DWORD entry called “WriteProtect”. Select the “StorageDevicePolicies” folder and right-click on the left pane to display the context menu. Move your mouse pointer over “New” and click on the “DWORD (32-bit) value” option.
Rename the new DWORD entry to “WriteProtect”, such as: example under.
Since we now have the entry “WriteProtect”, we have to change its value data to “0”. In this way, you can turn off write protection on your storage device. To do this, double-click the “WriteProtect” entry and change its value to “0” if it is not yet in this state.
To complete the process, restart your computer and see if the write protection has been removed from your storage device.
The worst case you might encounter is when you have already tried all of the methods but the write protection problem still persists. In this case, you should consider the possibility of formatting your drive.
The 10 best registry hacks for Windows 10