How to Use DiskPart to Clean and Format a Drive in Windows 10

By | January 9, 2022

Learn how to use the Windows integrated disk partitioning tool to manage your drives

Drives failing due to logical or physical problems are a common sight. Unfortunately, there’s no clear way to tell when or how a drive might fail. What we can try, however, is to make the corrupted storage drive usable.

This is where DiskPart comes into play. Here’s how to use DiskPart to wipe, reformat, and partition a drive ready for use.

What is DiskPart

DiskPart is a command line utility that Microsoft ships with Windows. In other words, DiskPart is on every Windows machine, so you don’t have to download it separately.

DiskPart allows you to delete data from local or external drives, reformat those drives into a file system of your choice, and create new volumes from existing storage blocks.

Now, since DiskPart is a command line tool, you need to know a few commands to use it.

How to Reformat a Drive Using DiskPart

While physical problems can never be fixed with software tools, you can solve logical problems by reformatting.

Reformatting a drive involves cleaning the drive, erasing any data you have on the drive, and formatting the drive to a file system of your choice. The process is simple but results in irreversible data loss, so back up your files before proceeding.

Open DiskPart and Select Disk

Open DiskPart by typing diskpart in the Start menu search bar, then select Best Match. This will open a Command Prompt window with DiskPart already selected.

Once the command line window opens, type disk list and press enter. You will see a list of all available disks appear on the screen. You’ll see the disk name in the first column, the status in the next column, and the size and free space in the next column. You can ignore the last two columns as they will be empty if your disk is working properly.

In the list, find the drive you want to format. You can find drives by size. If you don’t know the size, remove the drive, run the command again disk list, and note the disk number in the first column. Reconnect the drive, run the command, and you should see the new disk number in the list. This is your drive, so note the number.

Now, select the drive by typing select disk DISK-NUMBER, change DISK-NUMBER with the actual number of the disk you previously noted from the list.

For example, if I wanted to select Disk 2, as shown in the image below, I would type the command as select disk 2. Finally, press enter.

You will see a confirmation message telling you that your storage drive is selected. To verify this, type disk list and press enter. The list of drives that appears will mark the selected drive with an asterisk

in front of the drive number.

If you want to change the drive, repeat the select command with the disk number.

Clean and Partition Drive Now, before reformatting, make sure you have backed up your data. After this, type clean and pressenter

. This will erase all data from your drive. After DiskPart has successfully cleaned the drive, you will see a message on the screen.

Once the drive is cleaned, you are ready to reformat it.

One more thing before you proceed to reformat: you need to partition your drive before you can use it again. After cleaning the drive, your computer will no longer recognize the drive as a storage unit. So you need to partition it into blocks or blocks for your computer to recognize the device.

You should also consider partitioning your storage drive into multiple file systems if you will be using it with different operating systems. For example, you can partition some storage as exFat for Windows and part as an additional macOS partition for use with Macs. But for now, we’re just going to partition the drive into a single block of storage. So, type create partition primary or create part pri and pressEnter

. This will partition the drive into one block. After partitioning, make sure to enable the partition as your computer can only use the active partition. So, type active and pressenter

. This will create the partition you just made the active partition.

Format Drive With New File System

Finally, you can now reformat the drive. Type format fs= FILE-SYSTEM label=DRIVE-LABEL quick and pressEnter . Make sure to replace FILE-SYSTEM with the file system of your choice (such as NTFS, FAT, or exFAT) and LABEL

with the name of the drive.

For example, if you are formatting a removable USB drive to store music, replace FILE-SYSTEM with “exfat” and LABEL with “Music”.

A confirmation message will appear letting you know that the drive has been formatted.

Assign New Drive

The final step of the process is to assign a letter to your storage drive. Windows needs these letters to show drives in file explorer. Usually, the letters “C,” “D,” and “E” are already used by the internal storage device, so choose something else.

In any case, make sure to assign a letter that is not already in use by your internal drive. Typeassign letter=DRIVE-LETTER , replace DRIVE-LETTER with “f” and pressEnter

. You will receive a confirmation message letting you know that the drive has been assigned. Now, verify that you have done everything right by typing list volume and pressEnter

. The drive you just formatted will have an asterisk in front of it, and it will reflect all the properties you defined during the process. Close the DiskPart command line utility by typing exitand pressing



Reformatting Only Works for Logical Problems

Unfortunately, we can’t solve every storage problem by reformatting. If your drive repeatedly crashes or fails to show up after reformatting, this could indicate a hardware failure. And no one can solve hardware problems with software tools.

Unfortunately, that means you need to shell out some money and buy a new drive.