The Diskpart Tool is a command-line tool that can be used to manage partitions in a Windows system. It offers all the functions of Disk Management Tool and more. However, in some cases, the Diskpart utility is unable to change the attributes of the partitions and give the following message – Diskpart failed to clear disk attributes.
The probable causes of this issue are as follows:
- Bad sectors in the hard drive are associated with the partition.
- The partition might be hidden.
- For external drives, a physical write-protection switch might be enabled.
- The external drive might be in RAW format.
- Write-protection could be enabled for certain internal drives from the Registry as well.
Diskpart failed to clear disk attributes
You could try the following solutions to resolve the problem:
- Run the CHKDSK utility
- Check for a physical write-protection switch on external drives
- Change the format of the external drive from RAW to something else
- Remove Write protection via Registry.
1] Run the CHKDSK utility
The CHKDSK utility helps in checking for bad sectors in the hard-drive and repairing them. This should be the first step prior to concluding anything about the hardware.
2] Check for a physical write-protection switch on external drives
Some external drives have a physical write-protection switch on them. When the switch is turned ON, you wouldn’t be able to modify the contents of the drive.
A personal suggestion would be to exclude external drives while using the Diskpart utility, but if you have to use it, please turn OFF the toggle switch on the external drive.
3] Change the format of the external drive from RAW to something else
The RAW format gets created when certain files in an external drive are corrupt. It could also be caused by a hardware issue, but in that case, we cannot resolve the problem ourselves. In this situation, we would have to format the File System to either FAT or NTFS.
Press Win + R to open the Run window and type the command diskpart.
In the elevated Command prompt window which follows, type the following commands and press Enter after each one of them to execute it.
list volume select volume x format fs=fat32 quick exit.
Where x is the drive letter of the external drive to be formatted.
Once done, you could proceed with whatever you intended to do with the Diskpart command initially.
4] Remove Write protection via Registry
The Registry Editor method could be used to resolve the issue. The procedure to do so is as follows:
Press Win + R to open the Run window. Type the command regedit and press Enter to open the Registry Editor window.
Navigate to the following path in the Registry Editor:
On the right-pane, double-click on WriteProtect to edit its properties.
Change the value of Value Data to 0.
Click on OK to save the settings and restart the system.
If the above-mentioned solutions don’t work, the cause could be a hardware problem. You could consult a support technician.