Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 12.45 minutes in December 2020 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Diskpart failed to clear disk attributes – How to fix it

by | Dec 14, 2020

The error “diskpart failed to clear disk attributes” occurs while trying to transfer files to the USB pen drive or SD card.

Here at Bobcares, we have seen several such Windows-related errors as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at the cause and fix of this Windows error.


What causes ‘diskpart failed to clear disk attributes’ problem to arise

Generally, the error “diskpart failed to clear disk attributes” occurs while trying to transfer files to the USB pen drive or SD card. This error means that the disk is write-protected and one cannot write any data on it.

Diskpart failed to clear disk attributes

There are many reasons for the disk to fail to work. Here are some of the reasons.

  • 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 in RAW format. RAW format is created when a file system is corrupted or there are hardware issues.
  • Diskpart does not work for such kinds of formats.


How we resolve the error ‘diskpart failed to clear disk attributes’

Now let’s take a look at how our Support Engineers resolve this error message.


Method 1: Checking the Drive Space Usage and File Attributes

First, we ensure that there is enough disk space available. Also, we disable the read-only attribute of files because the write-protection error may arise due to space shortage or the read-only attributes of the file. Here are the steps for doing it.

  • First, we right-click on the Start menu and select the File Explorer.
  • Next, in the File Explorer window, we go to the file/folder location that we want to transfer to the external hard drive. Here we right-click on the file/folder and select Properties.
  • After that, in the Properties window, under the General tab, we navigate to the Attributes option at the bottom and uncheck the box next to Read-only.
  • Finally, we press the Apply button and then OK to save the changes and exit.

Now, we run the DiskPart command again and check if the issue resolves.


Method 2: By Removing Write Protection Via Registry Editor

If the USB hard drive is locked or shows the “disk is write-protected” error, then we remove the mode and unlock the pen drive using the Registry Editor.

But before we make any changes to the Registry Editor, we make sure to create a backup of the Registry data. We ensure this so that if we lose any data in the process, we can recover it back.

  • First, we press Win + R shortcut keys on the keyboard to open the Run command box.
  • Next, we write Regedit in the search box and hit Enter. It will open a Registry Editor window.
  • Then, we navigate to the below path in the Registry Editor:
    Now, under the Control folder, we look for StorageDevicePolicies. If the key is missing, we will create a new key. For that, we right-click on Control >> New >> Key.
  • After that, we rename the key as StorageDevicePolicies.
  • Then select StorageDevicePolicies and then go to the right side of the pane and right-click on an empty space. Here, we select New and then DWORD (32-bit) Value from the right-click menu.
  • We rename the DWORD Value as WriteProtect.
  • Then we double-click on WriteProtect to open the Edit Value dialogue box. Now, we go to the Value data field and set it to 0.
  • Finally, we press OK to save the changes and exit.

We then close the Registry Editor window and restart the PC. Now we try transferring the data to the pen drive and the read-only attribute should be gone now.


Method 3: By Reformatting the USB From RAW to Something Else

If the USN pen drive is in RAW format, we get a read-only error and it can be fixed using DiskPart. This mainly occurs due to incorrect partition format. So we reformat the drive.

  • First, we right-click on the Start menu and select Run.
  • Next, in the search field, we type diskpart and hit Enter.
  • After that, we press OK in the UAC prompt to run DiskPart as administrator.
  • Then we run the below commands one after another and hit Enter each time:
    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)


Method 4: Running an Antivirus Software

Here, we are using Windows built-in antivirus (Windows Defender) for scanning purposes. You can make use of any 3rd party antivirus tool to run a scan.

  • First, we right-click on the Start menu and select Settings.
  • Next, in the Settings window, we click on Update & Security.
  • Then on the left side of the pane, we select Windows Security.
  • Now, we go to the right side of the pane and under the Protection areas section, click on Virus & threat protection.
  • It opens a new window. We click on Virus & threat protection on the left side of the pane.
  • After that, we go to the right side of the pane and click on Scan options.
  • Under the Scan Options, we select a scan mode and press Scan now.
  • We make a choice from the scan options and press the Scan now button.

Once the scan completes, we run the DiskPart command again and the problem fixes.


Method 5: 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 mainly implemented to avoid accidental data deletion or overwriting.

In case, if the physical switch is toggled on, the Diskpart application will be unable to change the disk attribute to writable in any way.

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

[Need any further assistance in fixing Windows errors? – We are here to help you]



Today, we saw how our Support Engineers resolve the problem of diskpart failure to clear the disk attributes.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


var google_conversion_label = "owonCMyG5nEQ0aD71QM";


Submit a Comment

Your email address will not be published. Required fields are marked *