Home > Data Recovery Tips

How to Fix Corrupted Hard Drive Using cmd in Windows 11/10/8/7?

Updated on Friday, June 14, 2024

iBoysoft author Frances Yang

Written by

Frances Yang
Professional tech editor

Approved by

Jessica Shee

English Français

Summary: This post teaches you how to fix the corrupted hard drive using chkdsk and dispart cmd in Windows 10/8/7. If you have important data on the corrupted hard drive, it is recommended that you recover them with iBoysoft Data Recovery first, because the methods might cause data overwriting and cause permanent data loss.

fix corrupted hard drive using cmd on Windows

As popular storage devices, hard drives can suddenly get corrupted due to various reasons, such as aging, virus attack, and file system corruption. Once the hard drive is not working properly, you will have a hard time reading and writing to the hard drive normally, or even worse, all the saved data can be inaccessible.

Symptoms of corrupted hard drive

If your internal or external hard drive gets corrupted, it usually means that the drive is not recognized or working properly. The symptom of a failing or corrupted hard drive varies from case to case, but if you encounter one or multiple signs as listed below, you need to be careful when handling your hard drive.

1. Most of your files on the hard drive are corrupted or disappeared.

2. You receive an error message when you connect the hard drive to the PC or tend to open it. For example,

"X:\ is not accessible. Access is denied."

"You need to format the disk in drive before you can use it. Do you want to format it?"

3. When checking in Disk Properties, the hard drive shows 0 bytes of free and used space.

4. The hard drive shows RAW in Disk Management.

Even though your hard drive is corrupted, it doesn't mean that you need to say goodbye to it. The good news is that your hard drive doesn't have hardware damages that prevent you from fixing and recovering since it is detected by the computer. In other words, you can, fortunately, fix the hard drive using cmd on your Windows PC.

In the following paragraphs, how to recover lost data from the corrupted hard drive and fix the corrupted external hard drive and internal hard drive using cmd will be introduced in detail.

How to recover lost data from the corrupted hard drive?

Using cmd to check and repair the corrupted hard drive might overwrite the original data on the hard drive, resulting in irreparable data loss. Therefore, if you have important data on the hard drive, it is highly recommended that you retrieve them first with the help of data recovery software. If you don't need data recovery, please go-ahead to fix the corrupted hard drive using cmd.

In this situation, your files and folders have been lost, only powerful data recovery software like iBoysoft Data Recovery can help get back data.

iBoysoft Data Recovery is one of the best hard drive data recovery software for Windows. It enables you to recover lost data from corrupted hard drives. It can recover photos, videos, documents, email files, and other types of files from both internal hard drives and external hard drives. It works effectively on corrupted hard drives from Seagate, Western Digital, Samsung, Toshiba, and other notable hard drive manufacturers. In addition, the software supports data recovery when the hard drive is formatted. Moreover, this software can recover deleted or lost data from BitLocker encrypted partitions. If you accidentally deleted or lost one or more partitions on the hard drive, data recovery is also can be achieved successfully.

In addition to hard drive data recovery, iBoysoft Data Recovery can also apply to flash drives including USB flash drives, sd cards, memory sticks, etc. This software is fully compatible with Windows XP/Vista/7/8/10/11 and Windows Server 2003/2008/2012/2016/2019.

Tutorial: How to recover lost data from corrupted hard drive with iBoysoft Data Recovery

Step 1: Free download and install iBoysoft Data Recovery on your computer.

This is a lightweight tool and takes less than one minute to download. Run this .exe program and follow the onscreen instructions to install it on your Windows desktop or laptop.

Step 2: Launch iBoysoft Data Recovery,

Step 3:connect the corrupted external hard drive to the computer.

recover lost data from corrupted hard drive

Make sure you connect the hard drive to the computer through a good USB cable and port. After the software detects your drive, it will be listed in the home interface of the software with detailed information such as disk name, partitions, file system, and free space. If the software can't detect the free space of a partition or a disk, it will show a red bar.

Step 4: Select the corrupted hard drive and click the Next button. The program will start to scan for files on the corrupted hard drive.

The software is programmed with Quick scan and Deep scan. The quick scan will scan the disk fast to find recently deleted files, while the Deep scan will scan the disk thoroughly to rebuild the partition table, MBR, file system, and data section to find lost data. The software will automatically check the Deep scan option if it believes it is necessary. However, you can uncheck it to run a quick scan if you know your files are deleted not long ago. It will be more efficient.

recover lost data from corrupted hard drive

Step 5: Preview the scanning results after the scanning process finishes.

With a single click on a file, you will see detailed file information including thumbnail, file name, date created, and file size at the left window. By clicking the Preview button, the software will provoke built-in applications like Media Player or any pre-installed third-party application to view the whole content. Also, the software provides file filters and a search box to help you locate wanted files faster. All those pre-recovery features enable you to recover lost data efficiently. Moreover, once the files can be previewed, it is recoverable.

recover lost data from corrupted hard drive

Step 6: Select the files you want to recover and click the Recover button to save them to another location.

Do remember to save the recovered files to a reliable location to avoid data loss again. And, don't forget to check if you have recovered all the important files before you exit the software. Otherwise, you will have to spend time re-scanning the disk for data recovery.

How to repair a corrupted hard drive using cmd?

After you have recovered all lost files from the corrupted hard drive, two commands will help you fix the corrupted hard drive without data loss in Windows 10/8/7.

Method 1: Repair corrupted hard drive with chkdsk command

Chkdsk command is used to scan the integrity of the file system and fix minor logical errors on a disk by fixing soft bad sectors or marking hard bad sectors so that they won't be used again. This command is helpful if you want to fix the corrupted disk without formatting.

Steps of running the chkdsk command to repair a hard drive:

Step 1: Go to the start menu, and type in cmd in the search bar.

Step 2: Right-click cmd. exe and choose Run as administrator.

Step 3: Run the following command in the Command Prompt.

chkdsk *: /f /r /x

You need to replace * with the drive letter you wish to repair. For example, if you want to repair the G drive, you need to type in chkdsk G: /f /r /x.

If your corrupted disk cannot be fixed by the checks command or chkdsk is not available for the RAW disk, you will need to fix the corrupted/RAW disk using DiskPart. Or if an error message "Cannot open volume for direct access" occurs when you run chkdsk, you need to fix the chkdsk cannot direct access volume error first.

Method 2: Fix a corrupted hard drive with the disk part command

DiskPart is a command-line built-in utility on Windows. It allows users to modify both internal and external partitions with command lines. If the hard drive is corrupted and becomes RAW, you can use the diskpart command to convert RAW to NTFS/exFAT/FAT32. This command will forcedly format your corrupted hard drive and fix it at the same time.

 Warning: The following steps will reformat the disk and make your previously stored data inaccessible, so make sure you have adequate backups or have recovered all important data before proceeding.

Follow the steps to fix a corrupted hard disk using the diskpart command:

Step 1: Click the Start button.

Step 2: Type in the disk part in the search box.

Step 3: Right-click on diskpart.exe and select Run as Administrator.

Step 4: Run the following command line to list all the available partitions and drives.

list volume

According to the listed disk/partition information, the identity of which drive/partition is corrupted and you want to fix it. For example, scroll down to the picture below. In the picture, F is the target corrupted volume and becomes RAW, and its "Volume 6" is in the list.


Fix raw partition or disk using the DiskPart command

Step 5: Run the following command line. Be sure to choose the correct drive/partition and replace the volume number with your corrupted disk/partition.

select Volume 6

Step 6: Run the command line:

format fs=ntfs quick

 Note: If you want to format the disk to FAT32 using the diskpart command, change the command line to format fs=fat32 quick.

Step 7: Run the following command line to close the command prompt after you have seen the message saying "DiskPart successfully formatted the volume".


Besides the disk part command, you can also fix the corrupted hard disk by formatting the hard drive in Disk Management or File Explorer. It also can fix the corrupted hard drive problem on Windows. However, to avoid permanent data loss, you need to recover deleted or lost files from the disk first before formatting them.

Bonus: How to fix the corrupted hard drive by formatting

Method 1: Format the corrupted hard drive in Disk Management

  1. Go to "This PC".
  2. Right-click "This PC" and select "Management".
  3. Choose "Disk Management".
  4. Locate the RAW partition, right-click on the RAW partition, and select "Format".
  5. Input needed information and make sure Quick format is checked.
  6. Click on the "Format" button.

Method 2: Format the corrupted hard drive in File Explorer

  1. Go to "This Pc".
  2. Find the RAW partition and right-click it.
  3. Select "Format".
  4. Input needed information and make sure Quick format is checked.
  5. Click on the "Format" button.


Hopefully, you have recovered your lost data and fixed the corrupted hard drive after reading through the post. We also recommend you use your hard drive with care to avoid corruption again.