DiskPart — windowssystem32diskpart.exe
DiskPart is a full-featured program used to prepare hard disks, and
optionally divide them into two or more partitions. The Disk
Management tool (diskmgmt.msc) is the Windows
equivalent. Start DiskPart and then type help
to
view a list of all the available commands; some of the more useful
commands follow:
Command |
Description |
---|---|
active |
Activates the current basic partition so that it can be used as a boot disk; not necessary if it's the only partition. |
assign |
Assign a drive letter or mount point to the selected volume. Note that it is usually easier to use the Disk Management tool to do this. |
create |
Create a volume or partition. |
delete |
Delete an object (undoes the create command). |
detail |
Display details about an disk, partition, or volume. Note that you'll need to use select, first. |
exit |
Exit DiskPart (Ctrl-C also works). |
extend |
Extend a volume to fill free space immediately thereafter. |
list |
Display a list of all disks, partitions, or volumes. |
remove |
Remove a drive letter or mount point assignment (undoes the assign command). |
select |
Choose a disk, partition, or volume to view or modify. Use list to obtain object numbers for use with select. |
Each of these commands (with the exception of
exit
) has one or more subcommands. For example,
type detail
at the prompt to get a list of the
subcommands for use with the list
command:
disk
, partition
, and
volume
. So, to display a list of all the disk
volumes on the system, type list volume
. To select
a volume, type select volume 1
. Subsequent
commands will then apply to the currently selected volume.