In this article, I will explain the DiskPart command and some of the DiskPart commands to format, create and extend disks, volumes, partitions etc., using command-line shell.
DiskPart: DiskPart is a command interpreter, which enables you to manage the objects (disks, partitions, or volumes) by using scripts or direct an input from a command prompt.
To go to Disk Management, using Server Manger, go to Tools and click Computer Management.
Image: Server Manager Dashboard.
Under the Storage —> Disk Management —> Select Disk Management. —> You’ll find different disks and volumes.
Image: Computer Management
To switch to DiskPart
Open Command Prompt as an Administrator —> type DiskPart.
To list all the disks
Type list disk.
To list all the volumes
Type list volume.
To select a disk
Type select disk <disk number>, as shown below.
To create partition of the disk
To create new partition, type create partition primary size < specify the size in MB>, as shown below.
Once we create a new partition with 500 MB size, we can go back to Disk Management, using Computer Management and verify the newly created volume. As we can see below, there’s a new volume, which has been created with 500 MB size.
Image: Computer Management
To do a Quick Format of the disk volume
Type “format quick fs=ntfs label=“Unused Volume” ( You can give any name).
To verify the changes from the results given above, type list volume.
To see all the DiskPart commands
Type ?
To select a disk
Type exit
To switch to PowerShell
Once you exit from DiskPart, type PowerShell to switch to PowerShell.