Diskpart Failed to Clear Disk Attributes - Fixed

To solve Diskpart failed to clear disk attributed error on external hard drive and USB drive, you can modify WriteProtected Key via Registry Editor, check hard drive for errors, and so on.


By Dervish / Updated on February 11, 2024

Share this: instagram reddit

Diskpart failed to clear disk attributes

“When store files to my external hard drive, I get an error message says it is write-protected and I cannot write any data to the disk. Then I Google the message and was told to solve the problem with Diskpart. Here are the command lines: list disk > select disk 2 > attributes disk clear readonly. And then I get the prompting says: Diskpart failed to clear disk attributes. Well, guess I’ve got another problem. Any suggestion will be appreciated.”

Diskpart Failed to Clear Attributes

Did you come across the same problem? Search on the Internet, you can find Diskpart failed to clear disk attributes error also happens on USB flash drive, SD card, Pen drive, even internal hard drive in Windows 7, 8, 10, 11, XP and even Windows Server 2008/2012.

Disk attributes refer to disk characteristics such as disk free (MB), disk name, disk used (MB), file system status, file system type, inodes free and inodes used. Essentially, the disk attributes readonly refers to write-protected issue, i.e. you cannot write and modify any data on that volume or disk. Due to some kinds of reasons, Diskpart cannot remove the read only cluster successfully. What will be illustrated in this post is why you get the failed error message and how to remove the read only disk attributes in other methods.

Why Diskpart failed to clear disk read only cluster?

Every problem has its causes. If you find Diskpart failed to remove the read only attributes, it could be explained by one of following reasons.
There is physical write-protected tab on USB drive, SD card reader and external hard drive enclosure.
You did not run Diskpart as administrator.
The disk you selected possibly contains bad sectors, be set hidden or nodefaultdriveletter.
The disk you selected is a new USB drive with RAW format. The RAW format may result from corrupted file system. And Diskpart does not work for that sort of format properly.

Those are main possible reasons for “Diskpart failed to clear disk attributes readonly cluster”. Certainly, there are other factors affecting that. But what counts next is to figure out how to fix the problem easily.

How to fix Diskpart failed to clear disk attributes in Windows 11/10/8/7

To fix the error, you need different solutions under different circumstances. In the first place, make sure there is no physical write-protection tab, and if there is, switch it to the unlock side. Connect the external hard drive or USB flash drive to your PC and try following methods.

Modify WriteProtected key via Registry Editor

When the diskpart fails you on clearing disk attributes, turn to another utility.

1. Press Windows key and R key to open Run box. Type regedit and click OK.

2. Navigate to:


Note: If you cannot find the “StorageDevicePolicies”, you can create one manually. Right click the “Storage” folder and select “new” > “DWORD(32-bit) Value”. Then a new key will be created and is waiting for you to name it, type “writeprotect”.

3. Right click the WriteProtected key and select Modify. In the pop-up window, change value data from 1 to 0 (positive to negative).

Write Protect Value

Write data to the external drive. Or, run attributes disk clear readonly again and then write data to that disk. However, if the reason of diskpart failed is not write protected key, you’ll need other solutions.

Clear attributes on new RAW USB drive

In some cases, a new USB drive with RAW format can also get readonly error and the error cannot be removed by Diskpart. As covered, it may be affected by inappropriate partition format. In that case, you need to reformat the drive with another file system that can be recognized by Windows. Follow these steps to solve Diskpart failed to clear disk attributes on USB drive.

1. Open Run as instructed. Type diskpart and click OK. Run as administrator.

2. Type following commands in turn to format RAW drive.

• list volume
• select volume n (where n is the RAW drive)
• format fs=fat32 quick (you can replace “fat32” with “ntfs” or “exfat” as well)
• exit

Format RAW USB Drive

Note: You can type attributes disk to see the status of the selected disk.

It will be formatted and be recognized by Windows. Now, you can try the disk attributes clear command, or write data to the drive directly if you can. However, if you cannot format RAW drive in Diskpart, please refer to format RAW file system pen drive.

Check hard drive for errors

As mentioned before, bad sectors, partition set hidden and nodefaultdriveletter on the disk are also affecting factors. Therefore, you can check bad sectors to exclude the possibility.

1. Open Run box and type cmd. Run as administrator.

2. Type chkdsk F: /f (where F: is the partition you will check) and hit Enter. It will find bad sectors on the disk and try to fix them.


In some cases, the chkdsk command may not work, for example, it stuck during repairing. If that is the case, please refer to CHKDSK Windows 10 stuck for solutions.

Alternatively, to avoid the stuck error, you can do disk checking with the help of other tools. AOMEI Partition Assistant Standard is free partition manager that is able to check both hard disk and single partition with different arrangements. Also, you can solve the issue caused by hidden partition and nodefaultdriveletter. Download this freeware to get Diskpart failed to clear disk attributes fixed. Install and run AOMEI Partition Assistant on your computer.

Download Freeware Win 11/10/8.1/8/7/XP
Secure Download
  • Check Partition: right click the partition you want to check and select Advanced. Then hit Check Partition. Follow the wizard to complete.

Advanced Check Partition

  • Check Disk: to check the status of the entire disk, right click the disk and select Surface Test. Follow the wizard to complete.


  • Unhide Partition: right click the hidden partition and select Advanced, and then Unhide Partition. Follow the wizard to complete.

Unhinding Selected Partition

  • Assign Drive Letter: right click the partition you want to and select Advanced, and then Change Drive Letter. Select the new drive letter from the drop-down menu in the pop-up window, and click OK.

Change Drive Letter

Alternatively, you can assign drive letter with Diskpart: list volume > select volume n (where n is the number of the partition you want to assign to) > assign letter=F (you can replace R with other drive letters) > exit.

All operations will come to effect until you click on Apply on the tool bar and then Proceed in the popping up window.
To fix Diskpart failed to clear disk attributes in Windows 2008/2012 (R2)/2016/2019/2022, please repeat covered steps with AOMEI Partition Assistant Server edition.


When you get Diskpart failed to clear disk attributes” error in Windows 11,10, 8, 7, it is a wise move to achieve the goal with other methods. To remove the Readonly cluster, you can edit Writeprotected key in Registry Editor, completely format partition, or check and fix errors for that disk.

The advanced version, AOMEI Partition Assistant Professional supports command line operations, allocate free space from one partition to the other directly, convert system disk from MBR to GPT without data loss, and so on. You may want to upgrade to the Professional to have a try.

Dervish · Staff Editor
Dervish is an English editor of AOMEI Technology; He is delicated to offering users easy and effecitve solutions for issuses related to disks and partitoins. In his spare time, he enjoy wathcning films, playing footable, traveling and so on.