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 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 properly format a drive to fix corruptions and other disk problems.

How to clean and format a drive using DiskPart

To use DiskPart to fix a hard drive with problems on Windows 10, use these steps:

Important: Using these instructions will erase everything on the selected drive, and you can't undo the changes. If the drive is still accessible, it's recommended to backup your data before proceeding. If you have multiple drives connected to your computer, it's also recommended to disconnect them to minimize the chances of selecting the wrong partition.

Best online learning tools for kids: ABCmouse, Reading IQ, & more

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to launch DiskPart and press Enter:


  4. Type the following command to list all the drives connected to your computer and press Enter:

    list disk

  5. Type the following command to select the drive that you want to clean and press Enter:

    select disk 1

    In the command, make sure to replace 1 for the drive number that you want to delete. If you don't do this step correctly, you could end up wiping out the wrong drive, as such proceed with caution.

  6. Type the following command to wipe out the drive and press Enter:


  7. Type the following command to confirm the drive still selected and press Enter:

    lisk disk

    Quick note: The output should include an asterisk (*) next to the selected drive.

  8. Type the following command to create a new partition on the drive and press Enter:

    create partition primary

  9. Type the following command to select the new primary partition and press Enter:

    select partition 1

  10. Type the following command to make the selected partition active and press Enter:


  11. Type the following command to format the partition using the Microsoft NTFS file system and to 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 that you want to see when using File Explorer. Also, the quick flag is optional, but if you don't use it, the format will take a long time.

  12. Type the following command to assign a letter and make the drive available in File Explorer and press Enter:

    assign letter=w

    In the command, replace w with the drive letter that you want to use, and it's not assigned by another drive.

  13. Type the following command to terminate DiskPart and press Enter:


Once you complete the steps, if the drive didn't have any physical issues, 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:

Portable (and affordable) power accessories we love

Each and every one of these charging gadgets will keep your favorite gear and gadgets going for longer, and none of them costs more than $30.

VisionTek 8,000 mAh micro-USB power bank ($13 at Dell)

This compact dual-output powerbank can speedily recharge any and all your devices, thanks to a two-amp "fast charge feature," using its micro-USB out port. Its simple design includes an LED indicator, and it costs about as much as a single ticket to the movies.

Panasonic eneloop AA batteries (From $13 at Dell)

Panasonic's rechargeable batteries are among the best available, and just a couple of them will keep your favorite remote, mice or other peripherals powered up when you need them. They're also eco. And the company's affordable charger fits and charges both AA and AAA batteries at the same time.

Belkin Qi Wireless Charging Pad ($30 at Dell)

This unobtrusive Qi wireless charging pad looks good (and kind of like a UFO …) and easily charges all your Qi-compatible device up to 5W. Its LED indicator lights up when you're charging. And it costs just $30.

We may earn a commission for purchases using our links. Learn more.