Diskpart failed to clear disk attributes







Sometimes while trying to transfer files to a USB pen drive or SD card, we might experience an error such as "diskpart failed to clear disk attributes".
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix Windows related errors.
In this context, we shall look into the causes of this Windows error and how to fix it quickly.

What triggers the error "diskpart failed to clear disk attributes"?

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.
There are many reasons for the disk to fail to work. Here are some of the reasons.
i. There is a physical write-protected switch on the USB device or SD card.
ii. The disk which is trying to operate on has bad sectors or is set to be hidden.
iii. Diskpart application is not running as administrator.
iv. The new USB device is in RAW format. RAW format is created when a file system is corrupted or there are hardware issues.
v. Diskpart does not work for such kinds of formats.

How we fix the error "diskpart failed to clear disk attributes"?

To resolve this error message, follow the tips below.
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.
i. First, we right-click on the Start menu and select the File Explorer.
ii. 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.
iii. 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.
iv. 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.
i. First, we press Win + R shortcut keys on the keyboard to open the Run command box.
ii. Next, we write Regedit in the search box and hit Enter. It will open a Registry Editor window.
iii. Then, we navigate to the below path in the Registry Editor:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

iv. 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.
v. After that, we rename the key as StorageDevicePolicies.
vi. 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.
vii. We rename the DWORD Value as WriteProtect.
viii. 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.
ix. 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.
i. First, we right-click on the Start menu and select Run.
ii. Next, in the search field, we type diskpart and hit Enter.
iii. After that, we press OK in the UAC prompt to run DiskPart as administrator.
iv. 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)
exit


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.
i. First, we right-click on the Start menu and select Settings.
ii. Next, in the Settings window, we click on Update & Security.
iii. Then on the left side of the pane, we select Windows Security.
iv. Now, we go to the right side of the pane and under the Protection areas section, click on Virus & threat protection.
v. It opens a new window. We click on Virus & threat protection on the left side of the pane.
vi. After that, we go to the right side of the pane and click on Scan options.
vii. Under the Scan Options, we select a scan mode and press Scan now.
viii. 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 urgent assistance in fixing Windows errors? – We are here to help you]


Conclusion

This article will help you fix the problem of diskpart failure to clear the disk attributes.


For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com



Related Posts






Focus on your business, not your servers.

Click Here to Learn More






Recent Post