Fix Corrupt/ Failed Hard Drive using Diskpart on Command Prompt

Updated on July 30, 2022

If you were unable to access data from the hard drive, the possible reason could be hard drive corruption or logical failure leading to errors making data inaccessible. You will be able to find the easiest way to fix failed hard drive using Diskpart utility on Windows here, but before that it is important to have your data recovered. Download and try the software for free and keep your data safe before it’s too late.

What makes drive corrupt or failed?

There are several reasons, here are a few reasons that makes drive to fail or corrupt.

Logical damage caused by bad sectors, corrupt header, virus, issues with file system or corrupted partition table and many other reasons, could lead to logical failure of a hard drive.

Any damage caused to the physical components of an computer would lead to the failure of hard disk. Physical failure of hard drive cannot be undone unless it can be serviced. The only other way is to replace the hard disk.

A Few indications to help you identify the logical failures on a hard drive

    Unable to boot successful: When HDD fails, the error message is displayed saying- Disk boot failure - insert system disk and press Enter. That means BIOS is unable to read the disk.

    Takes too long to access files and folders: Every time you want to access any files or folder, it takes more than usual time to open.

    Black screen appears after the system boots up: One of the causes for black screen during boot up process is, Windows update gone wrong or hardware issue.

    • The error: The type of file system is raw, CHKDSK is not available for RAW drives. Whenever, the file is inaccessible that could be fixed using CHKDK. But when file turns RAW, CHKDSK won’t be of any use and displays the above error.

    The error: X:\ is not accessible. The file or directory is corrupted and unreadable: The error is displayed when the file or directory is severely corrupted and inaccessible on the HDD.

How to Fix Logical Failure / Corruption on hard drives?

If you are looking for the ways to fix failed hard drive, the best way to repair corrupt hard drive is using Diskpart commands in Command Prompt (CMD) with.

Command prompt is a Windows built-in utility to fix logical errors. Diskpart is a command interpreter that helps to manage drives existing on the hard disk. Also, with the an appropriate Diskpart commands you will be able to fix the failed hard drive in Windows PC.

How to Fix Failed Hard Drive Using Windows Diskpart Utility?

Fixing the corruption on a hard drive can be as simple as formatting the drive. If you are unable to access the drive itself, format the drive using Disk Management might not be an option. This is where you can effectively use Diskpart command shown to format the drive and fix corruption. Follow the steps carefully and perform the repair.

Note: Formatting of the drive, erases all the data existing on the drive, so go ahead and back up your data before doing so. If the drive is inaccessible, recover data from the inaccessible drive and then follow the steps given below.

    1. Open CMD in Admin Mode by selecting Command Prompt -> Run as Administrator

    2. Type Diskpart and press Enter

    3. Type list disk (This command displays all the disks connected to your system).

    4. Type select disk Z where Z is the number of the disk you want to repair.

    5. Type clean and press enter. The command Clean erases all the data present on the drive.

Once the drive has been cleaned, you must create a new partition on the drive

    1. Type create partition primary and press enter

    2. Now format FS=NTFS, this command formats the newly created drive to NTFS File System (You could use FAT32 file system too, but NTFS is recommended)

    The process might take too long to complete based on the filesystem and drive space specified.

    3. Now type assign letter= H to assign a letter to the drive. (H is the drive letter you choose to provide)

    These above-mentioned commands remove the drive and resets the partition. Hence, logical errors or corruption or any damage on hard drive gets fixed.

    What if there is no backup or you didn’t find any data after running Diskpart? You no need to worry! Download SFWare Hard drive recovery tool, a reliable data recovery solution that will easily recover data from failed and bad sectored hard drives. The tool comes with a robust search algorithm helps to scan every sector of formatted drive and locate the formatted data from the drive.

    How to Recover Data from Failed Hard Disk Drive?

    With SFWare hard drive recovery software, any user can perform data recovery from failed hard drive. Just follow these instructions:

    Download SFWare Hard drive Recovery Software on any Windows system and complete the installation steps. Run the tool (Attach the failed external drive to the PC if you want fix failed external disk).

    1: Click on Recover Drive/Partitions option present on the main screen. Select Drive/Partition Recovery on the next screen

    recover data from failed hard drive

    2: Now, select the drive from where you want to recover data and go to "Next" option to start the recovery process (Software will display all the available drives present in your system, including externally connected hard drives)

    select the failed drive to recover data from it

    3: Select the failed drive to recover data from it. Scanning process initiates. e

    4: Once the recovery process is completed, retrieved partition data will be displayed in "Data Type" and "File Type" views

    select the file type

    Now, you can verify your recovered files using Preview option and click on Save button to successfully store recovered data

    Using SFWare, you can also perform Dynamic Disks recovery with ease.

    What if your hard disk turns RAW and you are not able to access data. Well no worries, you can opt for SFWare Partition Recovery Software and easily recover data from RAW hard drive using the same steps mentioned above.


    Logical failure of hard drive could be hazardous and can lead to permanent data loss or system crash if it is not taken care of in time. Make sure you act immediately if any errors are observed on the drive. It is always to recommended to keep a back up of your data to avoid any data loss situation. If you have missed to keep backup, you can always rely on an efficient SFWare Data Recovery Software.