Diskpart

Diskpart is a Windows command-line utility (starting with Windows 2000) to manage hard disks, It’s used to add, edit, or remove partitions on a hard drive. To use DISKPART, type diskpart at the command promp.
The process is:
1. type Diskpark
2. Select a Drive
and 3. Select a partition.

DISKPART Example 1.
Deleting a partition:
1. Type Dispart
DISKPART>” is now the prompt.
2. List the drives:
DISKPART> list disk
3. Select a disk:
DISKPART> select disk 1
4. List the partitions:
DISKPART> list partition
5. Select a partition:
DISKPART> select partition 1
6. Delete the partition:
DISKPART> delete partition override
override” is the option to delete protected partition.

DISKPART Example 2.
Creating a partition:
1. Type Dispart
DISKPART>” is now the prompt.
2. List the drives:
DISKPART> list disk
3. Select a disk:
DISKPART> select disk 2
4. Create a Primary partitions:
DISKPART> create partition primary
5. Format the partitions:
DISKPART> format

To run Diskpart in a script
diskpart /s <script name>

List of diskpart commands:

ACTIVE – Mark the selected partition as active.
ADD – Add a mirror to a simple volume.
ASSIGN – Assign a drive letter or mount point to the selected volume.
ATTRIBUTES – Manipulate volume or disk attributes.
ATTACH – Attaches a virtual disk file.
AUTOMOUNT – Enable and disable automatic mounting of basic volumes.
BREAK – Break a mirror set.
CLEAN – Clear the configuration information, or all information, off the disk.
COMPACT – Attempts to reduce the physical size of the file.
CONVERT – Convert between different disk formats.
CREATE – Create a volume, partition or virtual disk.
DELETE – Delete an object.
DETAIL – Provide details about an object.
DETACH – Detaches a virtual disk file.
EXIT – Exit DiskPart.
EXTEND – Extend a volume.
EXPAND – Expands the maximum size available on a virtual disk.
FILESYSTEMS – Display current and supported file systems on the volume.
FORMAT – Format the volume or partition.
GPT – Assign attributes to the selected GPT partition.
HELP – Display a list of commands.
IMPORT – Import a disk group.
INACTIVE – Mark the selected partition as inactive.
LIST – Display a list of objects.
MERGE – Merges a child disk with its parents.
ONLINE – Online an object that is currently marked as offline.
OFFLINE – Offline an object that is currently marked as online.
RECOVER – Refreshes the state of all disks in the selected pack. Attempts recovery on disks in the invalid pack, and resynchronizes mirrored volumes and RAID5 volumes that have stale plex or parity data.
REM – Does nothing. This is used to comment scripts.
REMOVE – Remove a drive letter or mount point assignment.
REPAIR – Repair a RAID-5 volume with a failed member.
RESCAN – Rescan the computer looking for disks and volumes.
RETAIN – Place a retained partition under a simple volume.
SAN – Display or set the SAN policy for the currently booted OS.
SELECT – Shift the focus to an object.
SETID – Change the partition type.
SHRINK – Reduce the size of the selected volume.
UNIQUEID – Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature of a disk.