منوعات تقنية

Best Ways to Fix DiskPart Has Encountered an Error in Windows


DiskPart is a built-in Windows command-line utility that manages system disks and partitions. Many users resort to employing DiskPart, especially since it continues to function even if the Disk Management utility stops working. However, even this trusty tool can sometimes run into trouble. Read on to learn how to fix the most common DiskPart errors on Windows.

Good to know: have the Power Options disappeared from your computer? Learn how to bring them back.

Basic Troubleshooting

Before proceeding to the issue-specific fixes, it’s best to start with a few general approaches that could easily help take care of the issue.

  • Clean up system files: cache files tend to build up over time on your system and may eventually end up interfering with the performance of your computer. To prevent this, regularly run the Disk Cleanup utility on your PC.
  • Run a CHKDSK scan: this command scans your drive and fixes corrupted sections if it detects any. You can run it via Command Prompt with administrator privileges, but always launching cmd with admin rights when using DiskPart may keep the error at bay.
  • Check ports: DiskPart may encounter errors when an external drive is incorrectly connected to your system. Ensure that there is nothing wrong with your USB ports.

These quick fixes can resolve most DiskPart issues, but if you keep receiving an error, apply one of the following advanced troubleshooting methods. DiskPart errors are usually accompanied by a message. The displayed message will determine the problem-solving method that is needed.

1. DiskPart Has Encountered an Error: The Parameter Is Incorrect

This error often occurs when the targeted partition has bad sectors or the hard drive’s file system has been corrupted. Sometimes, changing the volume encryption driver can also cause this error. In such instances, the following solutions can help solve the issue.

Use the Built-in Error-Checking Tool

Take advantage of your system’s built-in error-checking tool to scan your drive for issues and repair the problems that are found.

  1. Open File Explorer, right-click your drive, then select “Properties.”
  1. Switch to the “Tools” tab, and click the “Check” button.
Clicking "Check" button under Tools in Properties window.
  1. Select “Scan and repair drive” to start the process.
Clicking "Scan and repair drive" in Error Checking tool.

Tip: getting an “Undoing changes on your computer” error on your PC? Check out our list of fixes for this particular issue.

Create a New Partition

Another solution for this particular error message starts with cleaning up your disk, then setting up a new partition.

  1. Right-click on the Start menu, and select “Windows Terminal (Admin).”
Selecting "Windows Terminal" from WinX menu.
  1. Type the following code, and press Enter:
Typing "diskpart" in Terminal app.
  1. To see available disks, type the following code, and hit Enter:
Bringing up the list of available disks on your system in Terminal app.
  1. Choose the disk you want to clean up by typing the following code and pressing Enter. Replace [x] with the number assigned to the disk in question.
Typing "select disk" command in Terminal app.
  1. Type the following code, and hit Enter:
Typing "clean" command in Terminal app.
  1. To create a new partition, type the following:
Typing "create partition primary" command in Terminal app.
  1. Select the new partition by entering the following code and pressing Enter:
Typing "select partition" command in Terminal app.
  1. Continue with the following code:
Typing "format fs" command in Terminal app.
  1. Specify a drive letter using the command. Replace [x] with a letter of your choice.
Typing "assign letter" command in Terminal app.
  1. Type the command below. Close the Windows Terminal, and restart your system to see whether the issue has been resolved.
Typing "exit" command in Terminal app.

2. DiskPart Has Encountered an Error: Access Is Denied

If you get this error when using DiskPart to format a USB drive, it’s usually because your drive is write-protected, and Command Prompt lacks the required permissions to access the drive.

Remove Write Protection

Follow these steps to disable the write protection, and your issue will be resolved:

  1. Right-click on the Start menu, and select “Run.”
Clicking on "Run" option in WinX menu.
  1. Type regedit in the text box, and click “OK.”
Typing "regedit" in Run window.
  1. In the Registry Editor, head to “Computer -> HKEY_LOCAL_MACHINE -> SYSTEM.”
Navigating to location in Registry Editor.
  1. Continue navigating to “CurrentControlSet -> Services.”
Navigating to the "Services" key in Registry Editor.
  1. Find and expand the “USBSTOR” key, and double-click on “Start” in the right panel.
Double-clicking on "Start" key in Registry Editor.
  1. Set the “Value Data” to “3,” and click “OK.” Close the Registry Editor.
Setting value data for "Start" key in Registry Editor.
  1. Restart your PC, and check whether the problem has been fixed.

FYI: learn why it’s a good idea to defrag your registry.

3. DiskPart Has Encountered an Error: I/O Device

This error appears when your operating system fails to perform an input/output (I/O) function while trying to access a drive. Several issues can cause this error, such as a corrupted partition.

Fixing this problem is a bit tricky. If you see the “DiskPart has encountered an error: I/O device” message when connecting an external or flash drive, disconnect and connect it to another port. If you see an error when using your external hard drive, you should try the basic methods mentioned earlier. You can also try the methods below:

Rebuild MBR Boot

Rebuilding MBR Boot can fix any corrupted partitions on your drive.

  1. Right-click on the Start menu, and select “Windows Terminal (Admin).”
Clicking on "Windows Terminal" from WinX menu.
  1. Type the following code, and press Enter:
Typing "bootrec/fixmbr" in Terminal app.
  1. Continue with the following command, then press Enter:
Typing "bootrec/fixboot" in Terminal app.
  1. Once the operations end, close Windows Terminal, and restart your PC.

Make Sure the Device Is Clean

Anything disrupting the connection between your computer and your device, from dirt and debris to damaged cables, can result in receiving the I/O device error. Make sure your device is clean and correctly connected by:

  • Cleaning the dust, dirt, and stains from your USB, external hard drive, and the surface of your CD/DVD
  • Changing the cable of your external hard drive
  • Checking the power supply of your device

4. DiskPart Has Encountered an Error: Data Error (Cyclic Redundancy Check)

This error usually arises due to a corrupted hard drive or registry file. A cluttered hard disk, files with faulty configurations, or any issues with program installations can also be behind the issue.

A Cyclic Redundancy Check error can result in data loss or system failure if left unresolved. Fortunately, you can easily fix this issue by using the built-in error-checking tool mentioned earlier.

Tip: Windows Troubleshooter not working as it should? We show you how to restore its functionality.

5. DiskPart Has Encountered an Error: The Device Is Not Ready

Disk failure or corruption in your mainboard’s storage controller is usually the main reason for this error. There are two solutions for resolving this issue:

Run Windows Troubleshooter

Try running the troubleshooter via these steps:

  1. Type “control panel” in the Windows search bar, and hit Enter.
Typing "control panel" in Windows Search.
  1. Click on “Troubleshooting” among the options.
Clicking on "Troubleshooting" option in Control Panel.
  1. Under “Hardware and Sound,” select “Configure a device.” Proceed with the troubleshooting. Windows will detect problems and suggest possible fixes.
Clicking "Configure a device" in Control Panel.

Uninstall the USB Controller

If troubleshooting your device didn’t fix the error, try uninstalling the USB controller:

  1. Right-click on the Start button, and open “Device Manager.”
Clicking "Device Manager" from WinX menu.
  1. Find and expand “Universal Serial Bus controllers.”
Expanding Universal Serial Bus Controllers option in Device Manager.
  1. Right-click on the first USB controller in the list, and select “Uninstall.”
Uninstalling USB driver in Device Manager.
  1. Hit “Uninstall” to confirm the uninstallation. Uninstall the rest of the USB controllers via the same method, and restart your computer to see whether the DiskPart issue has been resolved.
Confirm Uninstallation

Good to know: learn how to resolve the “External hard drive access denied” error in Windows.

6. DiskPart Has Encountered an Error: The Request Failed Due to a Fatal Device Hardware Error

A damaged hard drive is usually the main reason for this error. However, this issue may also occur when your device is uninitialized. Windows isn’t able to access or perform read-write operations on a disk that is not initialized and will therefore display this error.

Initialize Disk

You can initialize your hard drive from Disk Management by following these steps:

  1. Right-click on the Start button, and open “Disk Management.”
Clicking "Disk Management" from WinX menu.
  1. Find the unallocated disk. Right-click it, and select “Initialize Disk.”
  1. Opt for the “GPT” layout for your disk, and click “OK.” Once the process is complete, Disk Management will indicate that your drive is online.
  2. Close Disk Management, and check whether the issue has been resolved.

7. DiskPart Has Encountered an Error: The System Cannot Find The File Specified

Damage to your disk, USB drive, or SD card can result in this error. Therefore, you must first make sure that your disk or USB device is not damaged. Corrupted files and partitions can also cause this issue.

This error indicates that your drive’s file system may have changed to RAW, and you must format a RAW drive to use it. This is where third-party format software comes in handy. Consider employing one of the following tools:

Tip: if you’re seeing “The system cannot find the path specified” error as you’re trying to copy a file or folder path or installing a program, check out our dedicated post on the issue.

Frequently Asked Questions

Which is better: CHKDSK R or F?

The command chkdsk /f detects and fixes errors on your hard disk, while chkdsk /r locates your drive’s bad sectors and attempts to recover any readable data from them. Technically, the chkdsk /r command does the same thing as chkdsk /f, while also checking your drive’s bad sectors. If you want to find and resolve logical disk errors, chkdsk /f will suffice, but you can also use chkdsk /r to find physical disk errors.

Should I use GPT or MBR?

If you intend to create more than four partitions, GPT boot suits you better, as it supports a maximum of 128 primary partitions in Windows, while MBR can only hold 4. Moreover, GPT performs better than MBR for hard disks larger than 2TB. GPT also offers higher data security and enhances the performance of your system if your motherboard supports UEFI boot. On the other hand, if your motherboard doesn’t support UEFI boot, you have an older version of Windows, or your Windows is 32-bit, you should opt for MBR.

How do I recover files from a corrupted hard drive?

Several troubleshooting methods discussed here require formatting your hard disk, resulting in data loss. However, you can recover a significant portion of your data using the chkdsk command or recovery software before applying the advanced fixes mentioned above. EaseUS Data Recovery Wizard, Recuva, and Disk Drill Data Recovery are the best recovery software to save lost data. Even if the software fails to get your information back, you can contact a hard drive data recovery service and extract your data from even the most severely-damaged drives. SalvageData, CBL Data Recovery, and Ontrack are some of the best data recovery services available.

Image credit: Unsplash. All screenshots by Farhad Pashaei.

Farhad Pashaei
Farhad Pashaei

As a technophile, Farhad has spent the last decade getting hands-on experience with a variety of electronic devices, including smartphones, laptops, accessories, wearables, printers, and so on.

When he isn’t writing, you can bet he’s devouring information on products making their market foray, demonstrating his unquenchable thirst for technology.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

اترك تعليقاً

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *

زر الذهاب إلى الأعلى