On Windows 10, when you have external storage (such as a USB flash drive, removable hard drive, or SD card) that stops working as a result of data corruption or another problem, you can use DiskPart to properly erase everything and start fresh with a clean partition.
DiskPart is command tool that has been around even before Windows 10, and it allows you to use Command Prompt to manage drives, partitions, and volumes when other tools like Disk Management and Format won't work to fix the problem.
In this Windows 10 guide, we'll walk you through the steps to use the DiskPart command tool to clean and format a hard drive to fix data corruption and other disk problems.
How to fix hard drive problems with DiskPart
To fix a hard drive with problems with DiskPart commands on Windows 10, use these steps:
Important: These instructions will erase everything on the drive that you'll select changes can't be undone. If the drive is still accessible, it's recommended to backup its data before proceeding. If you have multiple drives connected to your device, it's recommended to disconnect them to avoid selecting the wrong one.
- Open Start.
- Search for Command Prompt, right-click the top result, and select the Run as administrator option.
Type the following command to launch DiskPart and press Enter:
Type the following command to list all the active drives and press Enter:
Type the following command to select the drive that you want to clean and press Enter:
select disk 0
In the command, make sure to replace 0 for the drive number that you want to repair. If you don't perform this step correctly, you could end up wiping out the wrong drive. Proceed with caution.
Type the following command to wipe out the drive and press Enter:
Type the following command to confirm the drive still selected and press Enter:
Quick note: The output should include an asterisk (*) next to the selected drive.
Type the following command to create a new partition and press Enter:
create partition primary
Type the following command to select the new primary partition and press Enter:
select partition 1
Type the following command to make the partition active and press Enter:
Type the following command to format the partition using the NTFS file system, set a drive label, and press Enter:
format FS=NTFS label=Data quick
In the command, remember to replace Data for the name of the drive as you want to appear in File Explorer. Also, the quick flag is optional for a faster format, and you should not use it if you're not sure the drive good to perform a bad sectors. The only downside about omitting the "quick" option is that formatting will take a very long time.
Type the following command to assign a letter and make the drive available in File Explorer and press Enter:
In the command, replace g with the drive letter that you want to use, which isn't currently assigned by another drive.
Type the following command to terminate DiskPart and press Enter:
Type the following command to close Command Prompt and press Enter:
Once you complete the steps, if the drive doesn't have a hardware issue, it should be available through File Explorer, and you can begin storing files on it.
More Windows 10 resources
For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:
- Windows 10 on Windows Central – All you need to know
- Windows 10 help, tips, and tricks
- Windows 10 forums on Windows Central
Check out they new HyperX Cloud Revolver + 7.1 gaming headset
This new headset from HyperX complements its Cloud Revolver lineup. It's a high-end option with virtual 7.1 surround sound and robust audio.
Review: Twin Mirror, the first self-published game from Dontnod, is a miss
Twin Mirror follows the standard Dontnod formula with some twists, but it ultimately fails because of its lackluster and selfish lead character.
NVIDIA's $399 RTX 3060 Ti is here, and it demolishes the RTX 2080 SUPER
NVIDIA has unveiled the latest product in the RTX 30 series, the RTX 3060 Ti. The GPU will go on sale starting December 2 for just $399, and it is faster than the $699 RTX 2080 SUPER.
These are the best PC sticks for when you're on the move
Instant computer, just add a screen! That’s the general idea of the ultra-portable PC Compute Sticks, but it can be hard to know which one you want. Relax, we’ve got you covered.