Position : Tips - DiskPart Has Encountered an Error? Here Are Solutions

DiskPart Has Encountered an Error? Here Are Solutions


When using DiskPart command line disk partitioning utility, you may receive "DiskPart has encountered an error" error which is followed by various error messages such as access is denied, the parameter is incorrect, I/O device error, media is write protected, device not ready, cyclic redundancy check, etc. In this article, we will talk about 6 types of errors occurred to DiskPart as well as corresponding solutions.



Error 1: DiskPart has encountered an error: Access is denied


Symptom

When you try to clear a USB flash drive with diskpart command, you may be blocked by the error:

DISKPART> clean

DiskPart has encountered an error: Access is denied.

See the System Event Log for more information.


If you check event log you might get something like this:

Failed to open device \\?\GLOBALROOT\Device\HarddiskVolume5. Error code: 5@020A0019

Let's see a real case about access denied issue:

"Hey everyone, I had an old SanDisk memory card with 8GB capacity. I haven't used it for 2 years. I inserted it to my laptop and Windows said it is not formatted. I attempted to format it in File Explorer, but Windows was unable to format it. So I tried formatting it using DiskPart, but it encountered an error: access is denied. I check event log and got: 'Failed to open device \\?\GLOBALROOT\Device\HarddiskVolume8. Error code: 5@020A0019 EventID 8' Anybody know how I can format the USB stick and remove the error?"


Causes

Usually, if the device you want to clean or format is considered to be blocked (e.g. write-protected) or hasn't been authorized, the DiskPart command won't be able to complete properly. For example, you didn't log in computer as administrator, as some user account might be restricted to use Command Prompt even though you run it as Administrator.


Solutions

Solution 1: Check system event logs to hunt down any problem

Since the error message prompts to see system event logs, you may as well check computer's logs for more information if you cannot find out what's causing the problem.

Step 1  Click Start menu to open Control Panel where you can select "Administrative Tools". Note: the option will be available after changing "View by" to "Large icons" at the top right corner.

Step 2  Double-click shortcut "Event Viewer" in Administrative tools window.

DiskPart Has Encountered an Error


Step 3  Expand "Windows Logs" to locate "System".

DiskPart Has Encountered an Error


Step 4  Double-click one of the logs in the top center area of Event Viewer and you can see detailed information about the event./p>

Solution 2: Run Command Prompt as an Administrator

Step 1  Restart computer and log in Administrator account.

Step 2  Click Start button, click All Programs and then select Accessories.

Step 3  Right-click Command Prompt and select Run as administrator.

Step 4  The UAC (User Account Control) dialog box comes up and you should provide permission or password to confirm the action.

Step 5  Type and execute DiskPart command again and the "Access is denied" error won't appear.


Error 2: DiskPart has encountered an error: The media is write protected


Symptom

"Hi, I have a 8GB SONY USB flash drive and I want to repartition it using DiskPart, because the flash drive turned to 189MB for no reason. I tried to format it in Command Prompt but receive the error 'DiskPart has encountered an error. The media is write protected. Sine the USB flash drive does not have a write-protect switch. Any ideas can help me remove write protection? "


Causes

It is easy to lose access of what you have stored on drive, as there are changes that files are deleted by accident or get damaged by virus. Some mass storage device provides write-protection function to protect files and folders. However, some drive still can be set to read-only even though there is not a write-protection switch. Reasons behind write protection error vary from one to another, let's see possible causes together.

  • The storage media is damaged by virus or malware and cannot work properly.
  • The read-only switch is placed to ON side by accident and the media becomes un-writable.
  • The disk is set to read-only in Property or Registry to prevent writing actions.
  • The drive has physical damages, such as bad sectors.

Solutions

Solution 1: Remove write protection using DiskPart

Step 1  Run Command Prompt as administrator, type in DiskPart and press Enter. To open Command prompt, press Win + R, type cmd in Run box and click OK.

Step 2  Type "list disk" and press Enter. Then all disks on your computer will be listed.

Step 3  Type in "select disk #" and press Enter key. You should replace # with the actual disk number, for example, you want to remove read-only for volumes on disk 1, then you should enter "select disk 1".

Step 4  Input "attribute disk" and press Enter. Now you can see whether the disk is read-only or not.

DiskPart Has Encountered an Error


Step 5  Type command "attribute disk clear readonly" and press Enter. The "Current Read-Only State" and "Read-only" will be set to No. Then you can try DiskPart to check whether the error is fixed.


Solution 2: Remove read-only state in Registry Editor

Step 1  Right-click Start button on the bottom-left corner and select Run. Type "regedit" in search box and press Enter key. Click "Yes" if you are asked by User Account control.

Step 2  Expand keys following the path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.

Step 3  If there is not StorageDevicePolicies on your computer, you need to create one. Right-click on "Control" and select "New" and "Key". Then name it as StorageDevicePolicies

DiskPart Has Encountered an Error


Step 4  Right-click StorageDevicePolicies and select "New" and "DWORD (32-bit) Value". Then rename it as "WriteProtect".

DiskPart Has Encountered an Error


Step 5  Right-click the newly created "WriteProtect" key and change the Value data to 0. Then click OK and close Registry Editor.


Error 3: DiskPart has encountered an I/O device error


Symptom

I/O device error occurs when device becomes unable to perform an Input / Output actions such as reading or copying data. This error can happen to various devices, including hard drive, external hard drive, USB flash drive, CD-ROM, DVD, SD card, etc. When you perform DiskPart on a disk which might be damaged, you are like to get the error message: DiskPart has encountered an error: The request could not be performed because of an I/O device error. If you access the disk in Windows you probably get same error message with error code 0x8007045D or 2147943517.


Causes

There are a number of possible causes for I/O device error and some are listed here:

  • There is something wrong with device connection, such as bad cables, loose connection, USB ports insufficient power supply.
  • The hardware is using an incompatible transfer mode or improper interface.
  • The CD or DVD disk you are accessing is damaged or dirty.
  • The storage device you are trying to use is damaged or defective. When you attempt to access data from a bad area, the error will appear.
  • Operating system is trying to use a transfer mode which cannot be used by the device.

Symptom

Solution 1: Check hardware connections

Since loose hardware connection is a common case of I/O device error, you should make sure all cables are well and correctly connected.

Step 1  If the error is caused by an external device such as external hard drive, you can connect the drive to another USB port on the computer.

Step 2  If the device is connected via USB hub, then connect the drive directly to computer's USB port in case of insufficient power supply.

Step 3  Replace the cable with a new one and reconnect storage device.

Step 4  If you are an advanced computer use, you can change cables for internal hard drives for a desktops or change enclosure for external HDD. If you are casual user then seek help from professionals.

If solutions above cannot resolve the I/O device error, connection is not likely the real case and you should continue with solution 2.


Solution 2: Change transfer mode for the device

If the transfer mode is configured incorrectly, Windows will not be able to transfer data among devices and computers. Thus the I/O device error might be fixed after changing to correct transfer mode.

Step 1  Open Device Manager. Right-click "This PC" and select Manage, then you can click Device Manager on the Computer Management window.

Step 2  Expand "IDE ATA/ATAPI controller" and you can see one or more listings for IDE ATA/ATAPI channels.

Step 3  Right-click the channel of the drive that causes I/O device error, select Properties and Advanced Settings tab. If you can't decide which IDE channel to select, you can choose the one tagged "Secondary IDE Channel"

Step 4  Select "PIO Only" option in the Transfer Mode box, and you can see the device (usually Device 0) throwing the error. Then click OK and close all windows.

Step 5  Restart computer and test whether the error is removed.


Error 4: DiskPart has encountered an error: The parameter is incorrect


Symptom

When you attempt to format or resize a volume via Diskpart.exe in Windows RT, Windows Server 2012, Windows 8, etc., you may receive an error message like:

DISKPART> shrink

DiskPart has encountered an error: The parameter is incorrect. See the System Event Log for more information

DISKPART>


Causes

The incorrect parameter issue occurs when the file system on the partition is corrupted or the full volume encryption driver has been changed in Windows.


Solutions

Solution 1: Run CHKDSK to fix volume errors in Windows 10

CHKDSK is one of the useful Windows built-in utilities. Sometimes Check Disk can be a lifesaver, as it is able to fix volume errors like "the parameter is incorrect". Please note that, if the volume contains important files, you should backup data before running chkdsk in case of any accidents.

Step 1  Open File Explore and right-click the drive which reports DiskPart encountered errors, then choose Properties.

Step 2  Click Tools tab in the Properties window and click Check button. (For Windows 7 users, the button is called "Check Now").

DiskPart Has Encountered an Error


Step 3  Windows may inform you that there is no need to scan this drive. You can click "Scan drive" to perform a manual scan.

DiskPart Has Encountered an Error


Step 4  Click Close button after the drive is successfully scanned.


Solution 2: Use Hotfix to fix the error

Step 1  Open Microsoft Support website and search for Hotfix. If the download is presented, then click the blue button "Hotfix Download Available".

Step 2  Click "I Accept" button for "Agreement for Microsoft Service".

Step 3  Select operating system version you are using, provide Email address and click "Request hotfix" button.

Step 4  Sign in the email address and open Inbox to find out the downloading link.

Step 5  Download hotfix and double-click the installer file. Then you can follow the on-screen instruction to install it. Restart computer after it is successfully installed.

Then you can try DiskPart again to check whether the parameter error appears or not.


How to recover files and folders when partition's parameter is incorrect?

Step 1  Launch DiskGenius, partition manager and data recovery software, to get its main interface, then select the partition which reports "Drive is not accessible. The parameter is incorrect". Click "Files" tab and check whether your files are displayed directly. If not, move to step 2.

download DiskGenius

Step 2  Select the volume in question and click "Load Current Partition Intelligently" option. If the partition is not damaged that badly, data will be displayed with original directory structure directly. If have no luck, then go to next step.

DiskPart Has Encountered an Error


Step 3  Select the partition again, click "File Recovery" button and click "Start" button. DiskGenius starts scanning the volume.

DiskPart Has Encountered an Error


Step 4  When scanning completes, you can view and preview recoverable. To get files successfully recovered, you need to copy them to another partition.


Error 5: DiskPart has encountered a data error (cyclic redundancy check)


Symptom

Generally speaking, the data error, cyclic redundancy check, indicates there are bad spots on storage devices. Often time, you will encounter this error when attempting to read or write data to bad sectors, for example, if you use DiskPart command to clean a disk which contains bad sectors, you are likely to get this error message:

DiskPart has encountered an error: Data error (cyclic redundancy check). See the System Event Log for more information.


Causes

This issue occurs if storage devices contain bad sectors.


Solutions

CHKDSK provides feature to verify bad sectors, but it is somewhat complicated. If you are not comfortable with Command Prompt, you can use DiskGenius to check bad sectors for the drive. DiskGenius is easier to use and it is able to repair bad sectors. What you should be aware is that bad sector repairing causes permanent damage to data, thus you should create a backup before performing any repairing actions.

Step 1  Choose partition / disk you want to check bad sectors and select "Verify Or Repair Bad Sectors" under Disk menu.

DiskPart Has Encountered an Error


Step 2  Click "Start Verify" button and it starts scan bad sectors. Bad sectors will be marked as red block (damaged).

DiskPart Has Encountered an Error


Step 3  When the verification complete, you can click "Repair" button to repair bad sectors.


Error 6: DiskPart has encountered device not ready error


Symptom

When you use DiskPart on a media which as a hardware problem, you stand a good chance to receive an error:

DiskPart has encountered an error: The device is not ready. See the System Event Log for more information.

If you check event log entry you might get "The driver detected a controller error on \Device" or "VDS fails to write boot code on a disk during clean operation. Error code: 80070015@02070008"


Causes

There is something wrong with the storage controller on your mainboard or the disk itself has failed.


Solutions

Solution 1: Disable and re-enable the USB controller

If the "Device is not ready" error happens to USB disks, you can try this solution to fix it.

Step 1  Open Device Manager again. Click Start button and enter "Device Manager" in search box and you can find and open it.

Step 2  Browse the list to locate and expand "Universal Serial Bus controllers."

Step 3  Right-click the first USB controller under "Universal Serial Bus controller" and click Uninstall. Then repeat this step until all USB controllers here are removed.

DiskPart Has Encountered an Error


Step 4  Restart computer and retry DiskPart to check whether it is working.


Solution 2: Run hardware and device troubleshooter

Step 1  Right-click Start button and select Control Panel. Type "troubleshoot" in the search box and Troubleshooting will be displayed. Click it.

Step 2  Click "Configure a device" under Hardware and Sound. If you are asked for confirmation or password, provide permission or password.

DiskPart Has Encountered an Error


Step 3  The Hardware and Devices Troubleshooter comes up, and you can click "Next" button to check potential problems.

DiskPart Has Encountered an Error


Step 4  When scanning completes, it will list a report. If errors are found, choose the ones you want to fix and click "Next" button. The troubleshooter will try to fix errors.

Summary

This article introduces 6 types of errors happens to DiskPart, including symptoms, causes and solutions. Hoping these solutions can help you a bit to troubleshoot DiskPart errors. Should you have any questions or better solutions, please feel free to contact us and share your ideas with all readers.


Comments

Tiana

2022-03-18 05:14:22

"access was decline to gumtree web page, please could this error be remove now."

"Hi, I am getting Error 6: DiskPart has encountered device not ready error and the event log entry is "VDS fails to write boot code on a disk during clean operation. Error code: 80070015@02070008". I tried all the listed solutions but no luck. Is there any other way to resolve this? Pls let me know if you want more input from me. I would really appreciate any help."

Abhishek Gupta

2020-11-04 00:02:33

Swagatam guha Roy

2020-08-09 00:24:39

"thank a tons it sovled my problem"

"Thx for the Event log tip. I have been having random diskpart issues since 2017. Found below error in my logs. Looks right. Rebooting often temporarily fixes my issue. Don't understand why Microsoft's telemetry has not caught on to this error and gotten a fix. Issue has been happening for at least 4 years. Filter Manager failed to attach to volume 'DeviceHarddisk1DR166'. This volume will be unavailable for filtering until a reboot. The final status was 0xC03A001C."

Richard Meadows

2020-06-25 23:49:37

nemo

2019-09-22 19:42:07

""DiskPart has encountered an error: A device which does not exist was specified. See the System Event Log for more information" this is hardware error or?"

"i want to remove write protection from my USB! so i typed (attributes disk ) in cmd ...it shows: current read_only status :yes read only :no but when i want to clean or format the USB it says ( the media is write protected)"

Kevin Barnes

2019-09-22 16:58:45

Shaher yar

2019-09-22 06:02:52

"DiskPart has encountered an error: The system cannot find the file specified. See the System Event Log for more information. that error which come after clean my usb through cmd. how can i format my usb if i try to format my usb with right click then the message comes "unable to format this windows". Kindly give me the solution. "

"diskpart has encountered an error the request could not be performed because of an i/o device error"

squymen

2019-05-26 13:04:47

sumit shah

2019-05-13 21:50:34

""Diskpart has encountered an error: the system cannot find the file specified. See the system event log for more information" how to solve this issue??"

"I want install windows 7 via command prompt on my pc. Through disk part I made a primary partition but it can not be format. The error is about event log. While I have no Windows on my pc how can I solve the problem?! please help :)"

Mary

2019-04-12 19:05:01

1 2

Submiting...

Wrong captcha

Email Format Error!

Incomplete forms!

Submit successfully!


*


Select the rating:


*

Your Name:


*

Your E-mail address:  


*

Your Message:


*

Verification Code:

Can't see clearly,
change for another