Windows Diskpart
The basics to disk and partition management with diskpart
Diskpart is a command line tool that doesn’t have as many restrictions as disk manager. It is still limited when working on the C:
drive, and not a good tool for partition manipulation. To alter the C:
drive, run it from run from the windows installer or from the windows PE.
This guide will walk you through wiping a disk and creating a single empty partition using the entire drive.
If you would like to only erase a disk refer to the diskpart clean factoid however, this will not securely erase your data, see the wiping disks article to do that.
-
To open DiskPart, you will need an elevated command prompt. Just type
diskpart
and DiskPart will load. -
To identify your disk, type
list disk
, then typeselect disk X
where X is the disk number. (Choosing the wrong disk will cause data loss) -
To wipe all partitions from your disk, type
clean
-
For disk type and partition structure, most cases will want basic and GPT. If this disk needs to be read on older systems, use MBR instead of GPT. Run
convert basic
orconvert gpt
based on what you need. -
To create the raw partition, run
create primary partition
. If you picked MBR, runactive
after creating the partition. -
Run
detail disk
andlist partition
to ensure that your disk looks correct and you have both the partition and volume selected. You should have a star next to the volume and partition.If either the partition or volume is missing, type
exit
, reconnect your drive and start over.If the partition or volume isn’t selected (you can tell by the star on the right), type
select partition X
orselect volume X
. -
To format the partition, type
format fs=<filesystem>
. For what file system to use, reference the following:To add a label at this stage, add
label=<label>
to your command.If you are using NTFS and want to enable file compression, add
compress
to your format command.To significantly speed up the format time, add
quick
.A full format command will look something like
format fs=fat32 label=Drive quick
. This will do a quick format with a label of “Drive” and file system of FAT32. -
To assign a drive letter to the new partition, run
assign letter=X
where X is the letter you choose. -
Type
exit
to close DiskPart. Your drive is formatted.