Disk Administration, Partition a disk
Syntax
DISKPART
Commands you may then issue at the DISKPART prompt:
LIST Disk
LIST Partition
LIST Volume
SELECT Disk n
SELECT Volume n
SELECT Partition n
DETAIL Disk
DETAIL Partition
DETAIL volume
HELP
REM (remark/comment)
EXIT
Commands to Manage Basic Disks:
ACTIVE (set the current in-focus partition to be the system partition)
ASSIGN (allocate the next free drive letter)
ASSIGN LETTER=l (Choose a free letter)
CREATE PARTITION Primary Size=50000 (50 GB)
CREATE PARTITION Extended Size=25000
CREATE PARTITION logical Size=25000
DELETE Partition
EXTEND Size=10000
REMOVE letter=l (Remove drive letter l from the in-focus partition)
REMOVE /ALL (Remove ALL current drive letters and mount points)
Commands to Manage Dynamic Disks:
ACTIVE (set the current in-focus partition to be the system partition)
ASSIGN (allocate the next free drive letter)
ASSIGN LETTER=l (Choose a free letter)
ADD disk=n (Add a mirror to the in-focus SIMPLE volume on the specified disk.)
BREAK disk=n (Break the current in-focus mirror)
CREATE VOLUME Simple Size=n Disk=n
CREATE VOLUME Stripe Size=n Disk=n,n,...
CREATE VOLUME Raid Size=n Disk=n,n,...
DELETE DISK
DELETE PARTITION
DELETE VOLUME
EXTEND disk=n [Size=n]
IMPORT
ONLINE
REMOVE letter=l (Remove drive letter l from the in-focus volume)
REMOVE /ALL (Remove ALL current drive letters and mount points)
RETAIN
Commands to Convert Disks
CONVERT mbr
CONVERT gpt
CONVERT dynamic
CONVERT basic
CLEAN ALL (remove all partition and volume info from the hard drive)
RESCAN
The diskpart commands may be placed in a text file (one command per line) and used as an input file to diskpart.exe:
DiskPart.exe < diskpart.txt Example: SELECT DISK 0 CREATE PARTITION PRIMARY ASSIGN LETTER=E SELECT PARTITION 1 FORMAT FS=NTFS LABEL="New Volume" QUICK EXIT
For more detailed information see Q300415
When selecting a volume or partition, you may use either the number or drive letter or the mount point path.
Always fully back up the hard disk you are manipulating.
"Divide et impera" - Latin saying (Divide and conquer)
Related:
Q325590 - Use Diskpart.exe to extend a data volume
Q300415 - A Description of the Diskpart Utility
Equivalent bash command (Linux): fdisk - Partition table manipulator for Linux