Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Fix Corrupted Hard Drive with DiskPart: Step-by-Step

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

DiskPart can fix a corrupted hard drive by cleaning the disk, recreating partitions, and formatting it with a healthy file system. This process erases all data, so back up anything important first. You'll need Windows (7 through 11) and administrator access.

What You'll Need

  • A Windows PC with the corrupted drive connected (internal or external via USB).
  • Administrator login credentials.
  • A backup of any data you want to keep (if the drive is still readable).
  • Patience – the process can take minutes to hours depending on drive size and condition.

Step-by-Step

  1. Back up data if possible. If the drive appears in File Explorer, copy files to another drive. If not, skip this step – you'll lose everything.
  2. Open Command Prompt as Administrator. Press Windows key, type cmd, right-click “Command Prompt” and select “Run as administrator”. Click “Yes” on the UAC prompt.
  3. Launch DiskPart. Type diskpart and press Enter. You'll see a new prompt: DISKPART>.
  4. List all disks. Type list disk and press Enter. Note the disk number of your corrupted drive (e.g., Disk 1). Be careful – the wrong disk will be wiped.
  5. Select the corrupted drive. Type select disk X (replace X with the actual number) and press Enter. DiskPart confirms: “Disk X is now the selected disk.”
  6. Clean the drive. Type clean and press Enter. This removes all partitions and volume information, making the drive appear as unallocated space. It does not physically erase data, but makes it inaccessible.
  7. Convert to GPT (recommended for modern systems). Type convert gpt and press Enter. If you need legacy BIOS compatibility, use convert mbr instead. This step is optional but recommended for UEFI systems.
  8. Create a primary partition. Type create partition primary and press Enter. DiskPart creates a partition covering the whole drive.
  9. Select the new partition. Type select partition 1 and press Enter.
  10. Format the partition. Type format fs=ntfs quick and press Enter. For a slower, more thorough format (which can help with bad sectors), omit quick. NTFS is standard for Windows. If the drive will be used as external storage with Macs, consider exfat instead.
  11. Assign a drive letter. Type assign and press Enter. Windows assigns the next available letter.
  12. Exit DiskPart. Type exit and press Enter, then close Command Prompt.
  13. Check the drive. Open File Explorer – the drive should appear with a letter and be ready to use. Copy a test file to confirm it works.

Common Mistakes

  • Selecting the wrong disk. Double-check the disk number in list disk. A wrong selection wipes the wrong drive.
  • Skipping the backup. DiskPart's clean and format commands destroy all data. There is no undo.
  • Using clean all unnecessarily. clean all zeroes every sector and takes hours. Use plain clean unless you need to securely erase.
  • Formatting with the wrong file system. NTFS works for Windows-only use; exFAT is better for cross-platform external drives.
  • Not running as administrator. DiskPart requires admin rights. If you see “Access denied”, close and reopen Command Prompt as admin.

Tips

  • Before using DiskPart, try chkdsk X: /f (replace X with drive letter) – it can fix file system corruption without wiping data.
  • If the drive is making clicking noises or is not detected at all, DiskPart may not help – it's likely a physical failure. Stop using it to avoid further damage.
  • For a large drive (e.g., 2TB+), the quick format is fine for most cases. A full format takes much longer but can detect bad sectors.
  • After formatting, run chkdsk X: /r to scan for bad sectors and attempt recovery – this can take hours but is worth it.
  • If the drive is external, connect it directly to a USB port (not a hub) to avoid power issues.

Troubleshooting

DiskPart says “Access is denied” or “Insufficient permissions”. Close Command Prompt and reopen it as administrator. Also check that the drive is not write-protected (some SD cards and USB drives have a physical lock switch).

DiskPart hangs at “Clean”. The drive may have bad sectors or a failing controller. Wait 10 minutes; if still stuck, close Command Prompt, disconnect the drive, and try again. If it repeats, the drive is likely physically failing.

Drive is not listed in list disk. Check connections – try a different cable, port, or computer. If it's an internal drive, check BIOS/UEFI to see if it's detected there. If not, it's likely dead.

Format fails with “The volume is too big” or similar. Ensure you selected the correct partition. If the drive is over 2TB and you used MBR, convert to GPT first (step 7).

After formatting, the drive shows as RAW again. This indicates physical damage or failing sectors. Run chkdsk X: /r to attempt repair, but if it reoccurs, replace the drive.

If DiskPart cannot fix it at all. The drive may be beyond software repair. Consider professional data recovery (expensive) or replace the drive. For a system drive that won't boot, try Windows Recovery Environment's Command Prompt instead of the normal one.

Frequently Asked Questions

Will DiskPart fix a physically damaged hard drive?

No. DiskPart only fixes logical corruption (file system, partition table). Physical issues like clicking sounds, motor failure, or bad sectors cannot be repaired by software.

Does DiskPart erase all data?

Yes. The clean command removes all partitions and the format command overwrites the file system. Data is unrecoverable without specialized tools. Always back up first.

Can I use DiskPart on an SSD?

Yes, the steps are the same. However, SSDs rarely have logical corruption – if an SSD fails, it's usually a controller issue that DiskPart can't fix.

What is the difference between clean and clean all?

clean removes partition and volume information quickly. clean all overwrites every sector with zeros, which takes hours and makes data recovery impossible. Use clean for normal fixes.

Can I recover data after using DiskPart clean?

Possibly, with professional recovery software or services, but not guaranteed. The data is not physically erased, but the file system structure is gone. Act quickly and stop using the drive to improve chances.

Is DiskPart safe for a drive with bad sectors?

It can be, but it won't repair bad sectors. Formatting may mark them as unusable, but if the drive has many bad sectors, it's likely failing and should be replaced.