Live Chat
Home » Blog » Technology » Diskpart Failed to Clear Disk Attributes – Complete Fix Guide
Technology

Diskpart Failed to Clear Disk Attributes – Complete Fix Guide

  author
Published By Ashwani Tiwari
Tej Pratap Shukla
Approved By Tej Pratap Shukla
Published On August 27th, 2025
Reading Time 5 Minutes Reading

Summary: If you have ever tried to clean, format, or reassign a storage drive in Windows and met the error, like “diskpart failed to clear disk attributes”, you are not the only one. When users try to delete any read-only feature or want to make some changes regarding the disk properties, this error typically happens. A usual example will be the flash drive, SD card, or external hard disk that suddenly becomes write-protected so that you are prevented from modifying it.

This article will take you through the reasons for its occurrence, the proper method to snap it within no time, and an alternative software that can work on any stubborn disks when no built-in methods work.

Why Does “Diskpart Failed to Clear Disk Attributes” Occur?

This error can show up due to several reasons:

  • Hardware write-protection – Some external drives and SD cards include a hardware switch to protect the device from modification.
  • Registry or policy restrictions – It is possible for a system-level policy to prevent editing disk attributes.
  • Corrupted file system or bad sectors – The physical damage may lock the drive.
  • Permission problem – Windows may restrict your access for not have enough rights.
  • Malware or encryption – The infections can impose limiting factors on the storage media.

Methods to Fix “Diskpart Failed to Clear Disk Attributes”

In the following, we will be going through detailed methods to troubleshoot and resolve this error.

Method 1: Check Physical Write Protection Switch

Some USB drives and SD cards have a small physical switch to toggle write protection.

  • Disconnect the drive from your computer.
  • Look closely for a lock/unlock slider.
  • Place it in the unlock position, then reinsert the drive.
  • Try using DiskPart again.

If the switch is already open, proceed to software-based repairs.

Method 2: Run Command Prompt as Administrator

This error is mostly the result of not running DiskPart with admin rights.

  1. Press Win + S and type cmd.
  2. Windows Win+X Command Prompt → Run as administrator

Enter the following commands:

  • diskpart
  • list disk
  • select disk X   (replace X with your disk number)

attributes disk clear readonly

The output should remove the read-only attribute if the command runs. If not, proceed with the registry and group policy ways.

Method 3: Use Windows Registry Editor

When DiskPart shows the result as: diskpart failed to clear disk attributes, the problem might concern registry restrictions.

  1. Click on Win + R, type in regedit, and hit Enter.

Navigate to:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

  1. In the right-hand panel, find WriteProtect.
  2. Double click this and put Value Data = 0
  3. Restart your system.

However, if there is no StorageDevicePolicies, you can manually create it.

Method 4: Modify Group Policy Settings

Besides these, if you are using Windows Pro and Enterprise editions, there are some policies that can restrict storage devices.

  1. At first, Press Win + R, type gpedit.msc. Hit the Enter button.

Navigate to:

Computer Configuration > Administrative Templates > System > Removable Storage Access

  1. Search for entries like Removable Disks: Deny write access.
  2. Finally, double-click and set the entries to Disabled.

After all these are done, restart your system and try opening DiskPart again.

Method 5: Check Disk Errors with CHKDSK

The error may be due to a corrupted file system. CHKDSK can be used to address logical errors.

  1. Open Command Prompt as Administrator.
  2. Type:

chkdsk X: /f /r /x

(Here, you can replace X with your drive letter.)

Wait for the scan to complete and then attempt to open the DiskPart again.

Method 6: Format Using Disk Management

  1. If all the above fail to fix “diskpart failed to clear disk attributes”, go to Disk Management.
  2. At first, press Win + X → choose Disk Management.
  3. Then, locate the problematic drive.
  4. Right-click → Format.
  5. After that, select the File System (NTFS, FAT32, or exFAT) and click on OK.

This method deletes everything, so make sure to back up any important files beforehand.

Method 7: Use a Third-Party Tool

If the manual solutions are not working, then a professional tool can help in removing all files of hard drive. Users can use the highly recommended tool, i.e., SysTools File Shredder Software, which removes restrictions and also wipes data permanently and unrecoverably. Moreover, this application becomes especially effective when it comes to stubborn properties that Windows tools cannot erase.

Final Thoughts

The error “diskpart failed to clear disk attributes” can be troublesome, but the above methods help you to fix it in a relatively short time. Begin from the basics, like ensuring physical switches are turned on, and move to the advanced fixes like changing registry settings or using CHKDSK. If all the solutions you tested did not work, then the best option is third-party utilities that will give you a permanent solution.

In short, adopting these approaches will bring your data management back on track and ensure that you can always get over your storage devices and thus save yourself from such interruptions in the future.

  author

By Ashwani Tiwari

I am an Expert Technical Analyst, specialized in assisting users with complex technological challenges. Through my blogs and articles, I offer expert guidance to help tackle these technical issues effectively. My true passion lies in providing valuable insights and simplifying complicated technicalities, enhancing user understanding and confidence.