How to Fix Diskpart Failed to Clear Disk Attributes Error

Brithny updated on Jan 18, 2021 to Computer Instruction | How-to Articles

Sometimes, when your hard drive, USB pen drive or SD card is read-only or write-protected, you'll need to run Diskpart with attributes disk clear readonly command to remove the read-only state from your device.

However, some people complaint that Diskpart failed to clear disk attributes for unknown reasons. On this page, we'll discuss this issue and find efficient fixes for you to address this issue, making your drive and data usable again:

Overview of Diskpart Failed to Clear Disk Attributes

In this part, you will learn:

  1. 1. What is Diskpart failed to clear disk attributes error
  2. 2. Why is Diskpart not working

Diskpart failed to clear disk attributes error is an error message that prompted by Diskpart while executing the read-only clear command. Here is how this error comes out:

You run the attributes disk command in Diskpart to test the state of your inaccessible device. And you see the "Current Read-only Start: Yes" "Read-Only: Yes", so you type attributes disk clear read-only in Diskpart, trying to remove it. 

However, for some unknown reasons, the Diskpart failed to execute the operation. Diskpart pops up the error message, telling that, "Diskpart failed to clear disk attributes" as shown below: 

Diskpart failed to clear disk attributes

So why is Diskpart not working while running the attributes disk command? Here is a list of reasons that can explain why did Diskpart fail to execute the operation on your devices:

  • The physical switch of USB, external hard drive, or SD is locked.
  • You failed to run Diskpart as Administrator.
  • Your device contains bad sectors or a corrupted file system.
  • Your device became RAW.
  • Virus or malware locked your device.

If your hard drive, USB, external hard drive, or SD card contains any one of the above issues, Diskpart cannot clear the read-only state. So how to remove read only attributes from your devices in Windows 10/8/7? Continue reading to find the best way out.

How to Fix Diskpart Failed to Clear Disk Attributes Issue [8 Methods]

Applies to: Fix and clear read-only attributes from your locked or write-protected internal/external hard drive, USB flash drive, SD card, etc., devices.

No matter how you encountered Diskpart clear read-only not working issue, here you can find 8 full solutions to solve the problem: 

  1. #1. Turn Off Device Physical Lock Switch
  2. #2. Run Diskpart as Administrator
  3. #3. Check and Fix Disk Error
  4. #4. Format Target Drive
  5. #5.Remove Write protection Using Regedit.exe
  6. #6. Use Regedit.exe Alternative
  7. #7. Run Diskpart Clean Command
  8. #8. Run Antivirus Software

Note that to avoid unnecessary file loss issue, we suggest you try Method 1, 2, 3 first as Method 4, 5, 6, 7, and 8 may cause file loss on your device. Also, if you lost files during the process, try reliable data recovery software like EaseUS Data Recovery Wizard for help. 

Let's start fixing this issue and remove read only attributes from your device now.

Method 1. Turn Off the Physical Lock Switch 

When you suffered Diskpart failed to clear disk attributes issue while running Diskpart to clear read-only disk attributes, you can first check the physical switch on your device.

Step 1. Find the physical switch on the hard drive, USB pen drive, or SD card.

Step 2. Check if the switch is on the Lockside.

Step 3. If yes, turn off it.

Fix Diskpart failed to clear disk attributes issue - turn off the physical Write protection switch

Step 4. Then go on running Diskpart clear read-only command and see if it can work properly.

Method 2. Run Diskpart as Administrator

Note that if you didn't log in to the computer as administrator or you failed to run Diskpart as an administrator, you won't be able to run the attribute disk clear readonly command.

Here's how to switch user account into admin state and run the Diskpart command:

Step 1. Click the Windows icon, click your username and select "Administrator".

 Log in and switch to your administrator account.

Switch user account

Step 2. Connect your read-only or locked device to your computer if it's an external storage device.

Step 3. Type cmd in Windows Search box and right-click Command Prompt to open it as "Administrator".

Step 4. Type diskpart and hit Enter.

Step 5. Type the following commands and hit Enter each time to clear the read only state from your device:

  • list disk
  • select disk 0 (Replace 0 with the disk number of your problematic drive.)
  • attributes disk clear readonly
Click to copy

Step 6. Type exit to close Diskpart when the process completes.

After this, you will find that Diskpart failed to clear disk attributes issue have gone away. And you should be able to open and make use of your files on the target drive again.

Method 3. Check and Fix Disk Errors 

Sometimes, when your storage device contains bad sector or file system errors, it will not be editable. As a result, Diskpart command line won't be executed successfully on the device.

Therefore, it suggests that you run a reliable tool to scan and fix existing corruptions or bad sectors on the drive. EaseUS partition software with its Check File System feature is able to help.

It will check and repair all the found errors on your device automatically. Here are the steps:

Step 1. Open EaseUS Partition Master on your computer. Then locate the disk, right-click the partition you want to check, and choose "Check File System".

Check Partition - Step 1

Step 2. In the Check File System window, keep the "Try to fix errors if found" option selected and click "Start".

Check Partition - Step 2

Step 3. The software will begin checking your partition file system on your disk. When it has completed, click "Finish".

Check Partition - Step 3

After fixing the device errors, you can try to open the device and see if it's still write-protected or read-only. If yes, revert to Method 2 and run Diskpart command lines to remove the error.

Method 4. Format RAW Target Drive

Note that another error that may disable Diskpart from running attribute disk clear readonly command is that your drive or external storage device becomes RAW. 

To fix this issue, you may directly format it into a recognized format like NTFS, FAT32, etc. Here are the steps:

If it's an external hard drive or USB, connect to your PC first.

Option 1. Format RAW Drive using EaseUS Formatting Tool

EaseUS Partition Master with its Format feature makes things easy for you to format any types of devices to NTFS, FAT32, exFAT, EXT, etc., in only a few clicks. Here are the steps:

If you need to format or convert a raw external storage device like SD card, USB or external hard drive, connect it to your PC first.

 

Step 1: Launch EaseUS Partition Master

Right-click on the RAW partition or RAW external hard drive/USB/SD card that you need to format and choose "Format".

Format Hard Drive Partition - Step 1

Step 2: Format RAW Partition and reset the file system

Assign a new partition label, set the file system to NTFS/FAT32/EXT2/EXT3, and cluster size to the selected partition, then click "OK".

Format Hard Drive Partition - Step 2

Step 3: In the Warning window, click "OK" to continue.

Format Hard Drive Partition - Step 3

Step 4: Keep all changes

Click the "Execute Operation" button in the top-left corner to view all the changes, then click "Apply" to start formatting your RAW partition/USB/SD/external hard drive.

Format Hard Drive Partition - Step 4

Option 2. Format RAW Drive Using Disk Management

Step 1. Right-click "This PC" or "My Computer" and click "Manage",  click "Disk Management".

Step 2. Right-click the RAW drive and choose "Format". Click "Yes".

select disk management and choose format

Step 3. Name the drive and select the file system as "NTFS" or "FAT32". Click "OK".

convert to fat32 using disk management

Step 4. Now, open the drive and see if it's still in read-only state.

If yes, continue with steps in Method 2 for to address the read-only issue.

Method 5. Remove Write protection using Regedit.exe

If your device is locked or with 'disk is write-protected' error, you can run Registry Editor to clear the mode and unlock your device to usable again. Here are the steps:

Step 1. Connect the read-only device to PC.

Step 2. Press Windows + R keys to open the Run box. Type regedit and click "OK".

Step 3. Navigate to path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

Step 4. Click the Write Protection icon, and set the Value data to "0". Click "OK".

Fix Diskpart failed to clear disk attributes issue using Regedit.exe

Method 6. Regedit.exe Alternative - Write-Protection Removal Tool

If you are not professional in computing management and not familiar with command lines, don't worry. EaseUS R&D team has promoted a fresh kit for helping you resolve the write-protection issue on your hard drive, external hard drive, USB or SD card, etc., devices.

EaseUS Tools M is a practical computer fixing tool that is safe and light-weighted. It's a perfect alternative to the command line. 

Use this one-click tool to solve the write-protection issues on your own:

Step 1: DOWNLOAD and install EaseUS Tools M for free.

Step 2: Run EaseUS Tools M on your PC, choose the "Write Protection" mode.

Step 3: Select the device which is now "Write-Protected" and click "Disable" to remove the protection.

Remove Write Protection from storage devices.

Method 7. Run Diskpart Clean Command

The other easy way to unlock a write-protected or locked device with "read-only" state is to run the clean command in Diskpart. But this will cause all partition and data loss on your drive.

So, please think twice before you move to the following steps:

Step 1. Connect your removable device to your computer first.

Step 2. Type cmd in the Search box and right-click Command Prompt to open it as Administrator.

Step 3. Type diskpart and hit Enter to open it.

Step 4. Type the following command and hit Enter each time.

The below commands will clean the device and force to remove the read-only state:

  • list disk
  • select disk 2
  • clean

Clean disk

Note that now your drive has no partition and everything on it has been removed completely. If you have precious files saved on it, turning to reliable data recovery software like EaseUS Data Recovery Wizard for help.

Step 5. Now, you can create a new partition on your device, making it work again with the following command lines:

  • list disk
  • select disk * (* represents the disk number)
  • create partition primary size=* (* means the partition size in MB.) 
  • assign letter=* (* represents Choose a drive letter not already being used.)
  • format fs=ntfs quick
  • exit

Crate new volume after cleaning disk

Now, your drive is in a good and healthy state that you can save and put in new data on it again.

Method 8. Run Antivirus Software

Sometimes, viruses or malware infections may block you from accessing your drive, making your drive showing as read-only. To fix this issue, you can also turn to antivirus software for help:

Step 1. Connect your read-only or locked drive to the PC.

Step 2. Install and run antivirus software on your computer.

Step 3. Select to clean and wipe out all suspicious viruses, malware from your drive.

Now, you are good to go and check if the drive is accessible and usable again.

After repairing all the possible disk errors, go to Diskpart to clear read-only disk attributes again to check if the issue is fixed.

To Sum Up

On this page, we explained what is "Diskpart failed to clear disk attributes" error and why is Diskpart not working in fixing this issue. We also collected 8 reliable solutions to help you address disk read-only error successfully, making your drive available for saving data again in Windows 10/8/7.

Note that your drive data may get lost during the process using these methods. So make sure that you have reliable data recovery software to count on. 

Also, we would like to remind you that to keep your drive healthy, do remember to check and fix errors on your drive timely using EaseUS Partition Master, cleaning up virus with antivirus tools, and backing up all valuable data in advance.

Was This Page Helpful?