Important: Using DiskPart will completely erase everything on the drive you select, making it impossible to undo any changes. It’s crucial that you correctly choose the drive you want to clean and format. We always recommend making a full backup of your system before proceeding.

  1. Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).
  2. Connect the drive you want clean and format to your computer.
  3. Type the following command and press Enter: diskpart
  4. Type the following command to list all the available drives and press Enter: list disk
  5. Take your time and very carefully, on the output from the previous command, identify the drive you want to clean. For example, in the screenshot below, we can see that we have four different drives listed, including Disk 0, which is 30GB, and we can quickly determine that it’s the primary system drive. And because we’re trying to clean an 8GB drive, we can easily spot that Disk 3 is the drive we need to select. Use the following command to select the drive and press Enter: select disk 3 Remember to change 3 in the command with the number of the drive you want to clean. If you fail to choose the correct number will erase all the data from the wrong drive.
  6. Type the following command to clean the drive and press Enter: clean
  7. Type the following command to double-check the drive still selected and press Enter: list disk If the drive still selected, you will notice an asterisk (*) next to the disk.
  8. Type the following command to create a partition and press Enter: create partition primary
  9. Type the following command to select the partition you just created and press Enter: select partition 1
  10. Type the following command to set the partition active and press Enter: active
  11. Type the following command to format the partition using NTFS and to set a label, and press Enter: format FS=NTFS label=WC-Drive quick Remember to change the WC-Drive in the command with the drive name you want to use.
  12. Type the following command to assign a drive letter and press Enter: assign letter=W Remember to change W in the command with a letter you want that isn’t in use by another drive on This PC.
  13. Use the exit command to close DiskPart to complete the task.

Again, using this guide, remember to take your time and carefully select the drive you want to repair. If you have multiple external drives connected to your computer, it’s a good idea to temporary disconnect them before proceeding to reduce the chances of erasing the wrong drive.

Keep in mind that while there is many other tools to format a drive, DiskPart is likely to be your best choice when you’re dealing with data corruption, drive inaccurately showing the storage capacity, and other serious problems.

Have you ever used DiskPart on Windows? Tell us your experience in the comments below.