diskpart

Disk Partition Management Utility

What Does It Do?

The DiskPart command is a powerful disk partitioning utility built into Windows. It allows you to manage disks, partitions, and volumes from the command line. DiskPart can create, delete, format, extend, shrink, and configure partitions on physical and virtual disks.

Think of DiskPart as your command-line disk surgery tool. It replaces the older fdisk utility and provides advanced capabilities for preparing drives, managing storage, and troubleshooting disk issues. It's essential for system administrators, IT professionals, and anyone who needs precise control over disk management.

Advertisement

[ Insert Google AdSense Banner Code Here ]

When Should I Use It?

Partition Management

Create, delete, resize, and format partitions on your disks.

Drive Letter Assignment

Assign, change, or remove drive letters from volumes.

Disk Cleanup

Wipe disks clean of all partitions and data (with caution!).

Volume Expansion

Extend or shrink volumes to optimize disk space usage.

Common Commands

Important: The → arrow means "run these commands one after another, NOT as a single command". Type each command separately and press Enter after each one.

diskpart

(First, enter DiskPart utility, then press Enter)

list disk

(Then, display all physical disks on the system)

select disk 0

(First, select disk 0, then press Enter)

list partition

(Then, list all partitions on that disk)

select partition 2

Select partition 2 on the currently selected disk to perform operations on it.

create partition primary size=50000

Create a new primary partition with a size of 50 GB (50,000 MB).

format fs=ntfs quick label="Data"

Quick format the selected partition as NTFS with the label "Data".

assign letter=E

Assign drive letter E to the selected volume or partition.

extend size=10000

Extend the selected volume by 10 GB into adjacent unallocated space.

Pro Tip: Always Verify Before Destructive Operations

Before running any destructive commands like CLEAN, DELETE, or FORMAT, always verify you've selected the correct disk:

1. list disk 2. select disk X 3. detail disk # Verify disk information 4. clean # Only after verification!

Warning: The CLEAN command permanently erases all data on the selected disk. There is no undo. Double-check the disk size, manufacturer, and other details before proceeding.

Try It Yourself

Practice DiskPart commands in the interactive terminal below: