Some users may fail to run the clean command in the DiskPart utility when trying to use it to clear an external hard drive, USB drive, or SD card. In order to help you out, we have sorted out fix fixes in this guide on MiniTool Website .

Diskpart Clean Not Working

DiskPart is an inbuilt command-line hard drive partitioning program in Windows. It allows you to partition internal or external hard drives and format removable storage devices like USB drives. The Clean command is one of its commands that can remove any and all partitions or volume formats from the drive.

Sometimes, some of you may encounter DiskPart Clean not working when trying to use this command to erase your external drive. In this condition, you are likely to receive the following error messages:

  • DiskPart Clean access is denied.
  • DiskPart Clean device is not ready.
  • DiskPart has encountered an I/O device error.
  • DiskPart has encountered an error: the media is write-protected.
  • DiskPart has encountered an error: Data error <cyclic redundancy check>.

As per the different types of error messages that you may meet, we will show you the corresponding fixes respectively for you.

How To Fix DiskPart Has Encountered An Error - Solved
How To Fix DiskPart Has Encountered An Error - Solved

The DiskPart has encountered an error may appear because of many reasons and I’ll analyze the causes & give solutions to you.

Read More

How To Fix DiskPart Clean Not Working on Windows 10/11?

Fix 1: Reconnect Your Target Drive to Your PC

When the external hard drive, USB drive, or SD card is not connected properly to your computer, it will lead to Diskpart not working with the Device not ready error on Windows 11/10/8. As a result, you can consider reconnecting your external hard drive, USB drive, or SD card.

Step 1. Unplug the USB drive or SD card from your PC. As for a hard drive, reinstall it via a power cable and a SATA cable.

Step 2. Reconnect the device to your computer.

Step 3. Log in to your computer as an administrator.

If you still cannot load the Clean command in DiskPart, please move to the next solution.

Fix USB Flash Drive Not Recognized & Recover Data – How To Do
Fix USB Flash Drive Not Recognized & Recover Data – How To Do

Various solutions are provided for you to fix USB flash drive not recognized error and recover data from the inaccessible flash drive.

Read More

Fix 2: Unlock the Drive & Remove Write Protection

Make sure that your disk is not write-protected or occupied by other programs, or else it will also trigger Diskpart Clean not working on your Windows PC. To do so, you can follow the guidelines below:

Preparation: Check If the Drive is Locked or Occupied

Step 1. Connect the target device to your computer.

Step 2. Press Win + E altogether to launch File Explorer .

Step 3. Go to This PC and turn on your device under Devices and drives to check whether the data on it is accessible or not.

hit your external drive

You may receive two error messages: the media is write-protected or Data error <cyclic redundancy check> . The former means that the device is write-protected and the latter indicates that it is being occupied by a running program or file without your knowledge.

If you do receive either of the messages above, you can try to unlock the drive or remove the write protection. Therefore, you need to unlock, decrypt, and remove the write protection to make Diskpart Clean work properly. There are two options for you: remove write protection by editing the registry key or remove the read-only state from the target device.

# Way 1: Remove Write Protection by Editing the Registry Key

When you confirm that the target device is write-protected, you can edit the relevant registry key to remove the write protection.

Step 1. Connect the target device to your computer.

Step 2. Press Win + R to open the Run dialog > type regedit > hit Enter to open Registry Editor .

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

Step 4. In the right pane, find the write Protection key and double-click it to change its value to 0 .

Tip : If you cannot find StorageDevicePolicies , you can create it manually: right-click on Control > select New > hit Key > rename the new key to StorageDevicePolicies > right-click it to choose New > hit Dword > specify the name as WriteProtect > double-click WriteProtect to set the value to 0 .

create a new key

Step 5. Hit OK to save the changes. Finally, close Registry Editor and reboot your computer.

# Way 2: Remove Read-Only State from Device

There is a chance that your external hard drive, USB drive, or SD card shows as Read-only in Disk Management. If so, take the steps below to clear this state:

Step 1. Connect this device to your computer.

Step 2. Type cmd in the search bar to locate Command Prompt and hit it.

Step 3. In the command window, type diskpart and hit Enter .

Step 4. type list disk and hit Enter to show all the disks on your computer.

Step 5. Type select disk # and hit Enter . ( # should be the actual disk number of your read-only device.) Here, we take removing read-only for volumes on disk 1 as an example, so we type select disk 1 and hit Enter .

choose the disk

Step 6. Type attributes disk clear readonly and hit Enter .

Fix 3: Run CHKDSK in Command Prompt

When DiskPart Clean stops working, you may receive a message telling you that DiskPart has encountered an error: The request could not be performed because of an I/O device error . This I/O (short for Input/Output) device error indicates that there are logically bad sectors, corrupted partition tables or physical sectors.

Although most disk I/O errors are caused by physical damage of the disk, running CHKDSK is also worth a try. Here’s how to do it:

Tip : In addition to running CHKDSK, you can also try reinstalling or updating Disk driver .