Fixed: Diskpart Clean Errors in Windows 10, 8, 7
This post shows how to fix Diskpart clean errors, including Access is denied, I/O device error, and the media is write-protected.
Diskpart is a powerful Windows built-in utility that can help you to clean or format hard drive or USB drive with ease. In most cases, your hard drive or USB drive is able to be cleaned successfully with the help of the Diskpart utility. But it is possible that the disk clean operation can’t be completed due to some errors and common three errors are listed below:
▪ Diskpart has encountered an error: Access is denied.
▪ Diskpart has encountered an I/O device error.
▪ Diskpart has encountered an error: the media is write-protected.
Since three common Diskpart clean errors have been described in the previous paragraph, the corresponding solutions will be presented in the following text.
When you receive the message that Diskpart has encountered an error: Access is denied, it means that your hard drive or USB drive is thought to be non-authorized or blocked.
At first, you can check the System Event Log to get more information: Click “Start” icon > Enter “eventvwr”> Press “Enter” > Click “Windows Logs” > Click “System” and you can look for RED circles for Errors and Critical > Click one > choose “Details and General” Table to gain more detailed information. You may find that you didn’t run command prompt as administrator. Then you can type “cmd” and press “Crtrl+Shif+Enter” to run command prompt as administrator.
If the Diskpart clean failed due to I/O device error, it is a lit bit complicated as this error could be caused by different events such as inappropriate connection, incompatible transfer mode, damaged hard drive or USB drive, and so on. Therefore, what you should first is to check the connection of the device. Having confirmed that the device connection is OK, you can try to clean your device again with Diskpart. If the error message that Diskpart has encountered an I/O device error still appears, you might consider that whether the transfer mode for your device is correct or there is something wrong with the device. Take measures as the steps given below:
1. Press “Windows + R”, type “devmgmt.msc” to enter Device Manger.
2. Then click “IDE ATA/ATAPI controllers” to expand it.
3. Right-click the channel where the device that you need to clean (usually, it is secondary IDE Channel) is connected
4. Choose “PIO Only” in the Transfer Mode Box for the proper device. Then, click “OK” and exit all windows.
5. Restart the Computer and observer whether the error is fixed.
If the problem still exists, you can try to check your device through the following steps: Double Click “This PC” > Right-click the target drive and select “Properties” > Click on Tools Tab and click “Check” icon. Then the file system errors or bad sectors that cause I/O device error will be resolved.
When the error message Diskpart has encountered an error: the media is write-protected appears, it means that your files on the device can’t be deleted or rewritten. You need to fix this error if you want to clean the drive.
If your device is USB drive that owns a physical read-only switch, you shall check the switch and put it to “OFF” side.
Then, you can clean or format the USB drive with Diskpart. If not, you can skip this operation and try one or more solutions listed below:
Solution 1. Disable write protection via Diskpart
1. Press “Windows + R” and enter “diskpart” in the pop-up box. Then hit “Enter” key.
2. Type the following command and hit “Enter” in order:
“list disk”> “select disk n”, where n is the number of the target disk >“attribute disk clear readonly”
Solution 2. Edit the registry
1. Press “Windows + R” and input “regedit”. Then, press “Enter”.
2. Navigate to the following paths:
3. Double click the “WriteProtect” Key and change the value to 0 in the pop-up window. Click “OK”.
Solution 3. Format drive via professional partition tool
When the two solutions are invalid, this error appears might due to corrupted file system. It is recommended to format the drive with a reliable third-party partition tool AOMEI Partition Assistant Standard. It can format drive with damaged file system successfully within a few steps and very easy to handle.
Step 1. Right-click the drive that you intend to format and choose “Format partition”.
Step 2. Determine the file system and cluster size. Click “OK”.
Step 4: Click “Apply” to complete the operation in the main user interface.
When Diskpart clean error appears, calm down, and take corresponding measures according to the different error messages. Well, it is also a good choice to simply apply third party tool to clean hard drive or format it in Windows 10/8/7.