DiskPart is a command line based disk management utility. Similar to the Disk Management tool, one can use DiskPart to create and manage drive partitions in a Windows system.

Stellar® Data Recovery offers a complete range of data recovery option to recover deleted data according to different data loss scenarios. Choose the most preferable data recovery option as per your need.

Stellar® Data Recovery for Windows

Exclusive Offer- Enjoy Unlimited Data Recovery for 1 Month @ ₹3,999

  • Get Instant Key
  • Get Service Coupon worth ₹ 1,500
  • Free Technical support

But DiskPart is a more advanced and powerful disk management tool that can help you fix critical drive errors and formatting related issues. However, sometimes storage drive can be write-protected, encrypted, or severely corrupt. In those cases, the DiskPart utility does not work and you see an error—while running DiskPart commands—such as,

Diskpart has encountered an error: Access is denied.
See the System Event Log for more information.

The error usually appears when you try to format or clean such external storage media, which includes external hard drive, pen drive, and SD card etc.

Common DiskPart Errors and Their Causes

You may also see the DiskPart error when the drive is suffering from following issues and errors:

1. Parameter is Incorrect

Parameter is incorrect is a common error occurs due to logical or physical damage to the storage drive, which makes drive inaccessible. The error may also appear when you try to copy some data to or from the storage media.

2. I/O Device Error

The Input/output device error occurs when Windows is not able to read, write or recognize the drive. This can happen due to reasons such as improper connection due to worn out connectors, damaged cable, lose or incorrect connection, incompatible hardware, and when the drive is logically damaged. Read more

3. CRC Error

Cyclic Redundancy Check or CRC error is a data verification method that system use to measure the data accuracy on the storage drives such as hard drives, SSDs, etc. It occurs due to logical drive corruption, damaged registry files, severely fragmented drives, and bad sectors. Read more

Follow our step-by-step instructional guide to safely restore data and fix the ‘DiskPart has encountered an error’ bug.

In the end, we have also mentioned some quick tips that can help you prevent such drive errors and corruption problems.

Step-by-Step Guide to Fixing DiskPart Errors

1. Recover Data from Disk

Download, install and launch Stellar® Data Recovery software.

Select All Data and click ‘Next’.

Guide-For-Diskpart-Error-1

Select the disk that is throwing DiskPart error and click ‘Scan’.

Guide-For-Diskpart-Error-2
Guide-For-Diskpart-Error-3

After the scan, select the files you wish to recover. You may also preview the files before saving them

Guide-For-Diskpart-Error-4

If the results are not desired, click ‘Click Here’ link at bottom to run a deep scan

After selecting the files from the scan results, click ‘Recover’.

Guide-For-Diskpart-Error-5

Select the desired location on an external drive and click ‘Start Saving’.

If the software doesn't work, damage could be physical. In that case, you must reach out to a data recovery expert for physical data recovery.

2. Run Command Prompt as Administrator

Press  ‘Windows+S’ and type CMD

Right-click on the Command Prompt option and choose ‘Run as administrator’.

Alternatively, you can also choose ‘Open File Location’, then right-click on Command Prompt, and choose ‘Run as administrator’.

Guide-For-Diskpart-Error-6

Now type the same clean or format DiskPart commands you were using when you saw the ‘DiskPart has encountered an error’

3. Disable Write-Protection

You can’t perform any operation on a write-protected storage media even with administrator access. You must disable the write-protection from the drive to use it and perform various DiskPart operations. Here are the steps to disable the Write-Protection:

If it’s an camera memory card or micro-SD card enclosed in a card adapter, make sure the Write-Protection switch is off—i.e. the lock switch position is upwards (refer to image)

Guide-For-Diskpart-Error-7

Steps to disable write protection via Registry Editor and DiskPart.

In case of a hard drive, pen drive, or other storage media without physical lock button or switch, follow these steps:

Step 1: Disable Read-Only State from Registry
  • Press ‘Windows+R’ and type regedit
  • Click ‘OK’ or press the ‘Enter’ key
  • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
  • If the StorageDevicePolicies is not found, create a new key. Simply right-click on ‘Control’ and choose New>Key
Guide-For-Diskpart-Error-8
  • Enter the key name as StorageDevicePolicies
  • Then right-click on StorageDevicePolicies and choose New>DWORD (32-bit) Value
Guide-For-Diskpart-Error-9
  • Rename the new DWORD to WriteProtect and double click on it to enter value 0 (see screenshot below)
Guide-For-Diskpart-Error-10
  • Now try to run the DiskPart commands on the storage media.
  • Click ‘OK’ to finish and then restart the system
Step 2: Disable Read-only from DiskPart
  • Open Command Prompt window as administrator
  • Type diskpart and press ‘Enter’
  • Then type following commands—one at a time followed by ‘Enter’ keypress after each command
    • list disk
    • select disk 1, Change value ‘1’ with the disk number that is throwing DiskPart error
    • attribute disk
    You will see if the disk is read-only or not
Guide-For-Diskpart-Error-11
  • If it’s read-only, type attribute disk clear read-only
    Then retry the DiskPart commands.

4. Check Drive Connection

Open the PC enclosure/cabinet and check hard drive SATA or USB cable for a firm connection. Disconnect the SATA or USB cable and inspect it thoroughly. Also, check the port and pins. Then reconnect the cable and try running the same DiskPart commands.

Guide-For-Diskpart-Error-12

5. Update Disk Drivers

Press  ‘Windows+X’ and then select ‘Device Manager’ from the options

Click on the Disk drive to expand it

Then right-click on the storage drive and choose ‘Update Driver’.

Guide-For-Diskpart-Error-13

Click  ‘Search automatically for updated driver software’ or download the driver from the manufacturer's website and click ‘Browse my computer for driver software’.

Guide-For-Diskpart-Error-14

Locate the downloaded drivers and select it

The driver will be updated

Alternatively, you can uninstall the drive driver and then restart the system. This will automatically install a fresh driver for the hardware.

6. Reinstall USB Host Controller

Within  Device Manager Window, double click ‘USB Serial Bus controller’ to expand.

Then right click on the host controller and choose to uninstall the device.

Guide-For-Diskpart-Error-15

Restart the system and then connect the USB drive.

This will reinstall the driver update and will freshly install the driver updates

Quick Tips to Prevent Disk Errors and Data Loss

1. Run CHKDSK

CHKDSK is a Windows utility that can check the integrity of your hard disk and can fix various file system errors. It's recommended to use this utility when your computer shows various disk errors.

2. Safely Remove the Drive

Always eject or safely remove external hard disk before unplugging to avoid disk errors and bad sectors on the drive.

3. Use Drive Monitor Utility

Drive Monitor is a free utility that comes embedded with Stellar® Data Recovery Premium software. It intelligently monitors your drive on the go for SMART errors such as reallocated sector count warning and lets you scan drive for bad sectors.

The utility also lets you clone the impeding drive and prevent a data loss situation due to drive failure.

4. Regularly Backup

To avoid permanent data loss due to disk errors and drive corruption due to reallocated sector counts, always maintain a regular backup. You can store files on local and cloud drive to stay protected.

Again, in case of data loss scenario, connect with our data recovery experts via phone, chat or email support.

100% of people found this article helpful

About The Author

Sapna Trivedi

Sapna Trivedi

Sr. Online Marketing Executive and Content Writer at Stellar Data Recovery.

Select Category