Menu Hide

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 for Windows

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

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

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.

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. 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.

Recover data from Disk

Download, install and launch Stellar Data Recovery software.

Select All Data and click ‘Next’.

Recover data from Disk

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

Recover data from Disk Recover data from Disk

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

Recover data from Disk

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’.

Recover data from Disk

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.

Special Offer from Stellar

Get exclusive offer on stellar data recovery software, drop email to

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’.

Run Command Prompt as Administrator

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

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)

Disable Write-Protection

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
      Run Command Prompt as Administrator
    • Enter the key name as StorageDevicePolicies
    • Then right-click on StorageDevicePolicies and choose New>DWORD (32-bit) Value
      Run Command Prompt as Administrator
    • Rename the new DWORD to WriteProtect and double click on it to enter value 0 (see screenshot below)
      Run Command Prompt as Administrator
    • Click ‘OK’ to finish and then restart the system
    Now try to run the DiskPart commands on the storage media.
  • 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
      Run Command Prompt as Administrator
    • If it’s read-only, type attribute disk clear read-only
    Then retry the DiskPart commands.

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.

Check Drive Connection

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’.

Update Disk Drivers

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

Update Disk Drivers

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.

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.

Reinstall USB Host Controller

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


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.

Stellar Offers Following Data Recovery Solutions

DIY Software

DIY Software

Stellar offers the widest range of DIY data recovery software for all operating systems/ file systems. The software recovers your lost, deleted or formatted data from all internal & external storage media.

Read More

Remote/Online Data Recovery

Remote/Online Data Recovery

Get back your data online now. We provide online data recovery service In some cases where data loss reason is logical And your storage media is detecting in your System.

Book Remote Session Read More

IN – lab Data Recovery

IN – lab Data Recovery

You need IN- Lab services when your storage media is not getting detected in system, and data loss reason is Physical. In all such cases our technician will perform data recovery in our CLASS 100 clean room lab.

Get FREE Quote Read More



Amid COVID-19 pandemic, Stellar® Data Recovery lab and recovery services are fully operational to serve your needs. You can avail our Online Remote Data Recovery Service. Stellar® encourages you to avail our free courier pick up service to submit your damaged media devices for data recovery