Fix: Diskpart failed to clear disk attributes

The error “Diskpart failed to clear disk attributes” occurs when the user tries to change the read-only state of a storage device using the Diskpart application and the request gets denied. Diskpart is the go-to choice for resolving read-only storage devices by changing their attribute through the command line.

If Diskpart is unable to change the attribute of the storage device, it will give an error message. This message is very common and if there are no physical attributes damaged, the error is resolved in no time. Do note that if you are receiving this error in Diskpart, there is a high probability that other software will also prompt a similar condition.

What causes the error ‘Diskpart failed to clear disk attributes’?

The inability of Diskpart to change the attribute state of your storage device from read-only to writable can be caused by a number of different varying reasons. Some of them are listed below:

  • There is a physical write-protected switch on the USB device or SD card.
  • The disk which is trying to operate on has bad sectors or is set to be hidden.
  • Diskpart application is not running as administrator.
  • The new USB device is with RAW format. RAW format is created when a file system is corrupted or there are hardware issues. Diskpart does not work for such kind of formats.

Before you continue with the solutions, you should make sure that you are running the Diskpart application as an administrator. If you do not have elevated access, the operating system might deny you access.

Solution 1: Turning the physical switch off

Some USB devices and SD card readers have a write-protected physical switch which disables all writable options on the storage device. This is implemented to counter accidental data deletion or overwriting. If the physical switch is toggled on, the Diskpart application will be unable to change the disk attribute to writable in any way.

Search for the physical switch at the sides of the device. Make sure it is toggled off and plug your storage device back on. First, try to normally transfer data and if that is unsuccessful, you can run the Diskpart application again as an administrator and try changing the attributes.

Solution 2: Modifying ‘WriteProtected’ key in Registry editor

Write protection is a registry entry in Windows registry editor and it acts a safeguard by limiting certain programs and applications by writing on storage devices. If the ‘WriteProtected’ flag is turned on, you will not be able to write data into your storage device successfully. To counter this, we will open the registry editor and change the key.

Note: The registry editor is a powerful tool. Only change keys which you know of, otherwise, the system can go into an error state.

  1. Press Windows + R, type “regedit” in the dialogue box and press Enter.
  2. Once in the registry editor, navigate to the following file path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
  1. Locate the entry “WriteProtect” at the left side of the window, double-click it and change its value to

  1. Press OK to save changes and exit. Restart your computer and try transferring data to your storage device again.

Solution 3: Checking drive for errors

If this error message is occurring on your hard drive, you should check it for bad sectors or logical errors. If any of these errors are present, Windows will be unsuccessful at changing the attribute type of the storage device. This method is not limited to hard drives; you can also chkdsk removable devices provided that they are recognized by the system. 1

  1. Press Windows + S, type “command prompt” in the dialogue box, right-click on the application and select “Run as administrator”.
  2. Once in elevated command prompt, execute the following command:
chkdsk F: /f

In this case, the letter ‘F’ corresponds to the volume of the disk. You can change it according to the letter allocated to the storage device in your system.

Solution 4: Clearing attributes on RAW

If you have a USB device with RAW format, chances are that you will be unable to change the disk attribute of the storage device. As mentioned before, Diskpart doesn’t operate well in RAW formats. In order to fix the issue, we will try to convert the storage type and then try to access.

  1. Press Windows + S, type “diskpart” in the dialogue box, right-click on the application and select “z”.
  2. Once in elevated command prompt, follow the commands listed:
list volume

select volume ‘n’ (replace ‘n’ with the volume number of the drive)

format fs=fat32 quick (you also have the flexibility to change the format to ‘ntfs’ or ‘exfat’)

exit.

  1. Plug out the removable storage device and wait a few seconds before plugging it in again. Now try any normal write operation and if it fails, you can run Diskpart again and attempt to change the attribute.

Solution 5: Check hardware components

If all the above methods failed and didn’t solve the error message under discussion, you should get your storage device checked. In many cases, this error signifies that there is a hardware problem which cannot be solved using conventional methods in Windows.

If you have a warranty, go to the nearby store and ask them to inspect the storage device. Also, you can try plugging the device into other ports or change the data cable if it is a hard drive.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

Fix: Diskpart failed to clear disk attributes

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested