DiskPart - Windows Disk Management

Master DiskPart, the powerful command-line disk partitioning utility built into Windows. Learn to manage disks, partitions, and volumes with precision.

How to Launch DiskPart

Method 1: Run Dialog (Recommended)
  1. Press Windows + R
  2. Type diskpart
  3. Press Ctrl + Shift + Enter (for admin privileges)
  4. Click "Yes" on UAC prompt
Method 2: Command Prompt
  1. Open Command Prompt as Administrator
  2. Type diskpart and press Enter
  3. Wait for DISKPART> prompt
  4. Begin entering commands
Note: DiskPart always requires administrator privileges to run.

Essential DiskPart Commands

CommandDescriptionExampleRisk Level
list diskDisplay all physical disksDISKPART> list diskSafe
list volumeDisplay all volumesDISKPART> list volumeSafe
list partitionDisplay partitions on selected diskDISKPART> list partitionSafe
select disk XSelect disk number X for operationsDISKPART> select disk 1Caution
select volume XSelect volume number XDISKPART> select volume 2Caution
cleanErase ALL data on selected diskDISKPART> cleanCritical
create partition primaryCreate a primary partitionDISKPART> create partition primary size=10240Caution
format fs=ntfs quickQuick format with NTFSDISKPART> format fs=ntfs quick label="Data"Caution
assign letter=XAssign drive letterDISKPART> assign letter=ELow
extendExtend selected volumeDISKPART> extend size=5000Caution
shrinkShrink selected volumeDISKPART> shrink desired=1000Caution
detail diskShow detailed disk informationDISKPART> detail diskSafe
attributesDisplay or set disk attributesDISKPART> attributes diskLow
exitExit DiskPart utilityDISKPART> exitSafe

Common DiskPart Operations

DISKPART> list disk
DISKPART> select disk 1
DISKPART> clean                           # WARNING: Erases all data!
DISKPART> create partition primary
DISKPART> format fs=ntfs quick label="NewDrive"
DISKPART> assign letter=E
DISKPART> exit
This sequence completely erases the selected disk!

DISKPART> list disk
DISKPART> select disk 2
DISKPART> attributes disk clear readonly
DISKPART> online disk
DISKPART> convert gpt                     # Or 'convert mbr' for MBR
DISKPART> create partition primary
DISKPART> format fs=ntfs quick
DISKPART> assign letter=F

DISKPART> list volume
DISKPART> select volume 3
DISKPART> extend size=10240              # Extend by 10GB
# Or extend using all available space:
DISKPART> extend
Volume can only be extended if unallocated space exists immediately after it.

DISKPART> list disk
DISKPART> select disk 2                  # Ensure this is your USB!
DISKPART> clean
DISKPART> create partition primary
DISKPART> select partition 1
DISKPART> active
DISKPART> format fs=fat32 quick
DISKPART> assign
DISKPART> exit
Triple-check the disk number - this will erase everything!

# To remove a drive letter:
DISKPART> list volume
DISKPART> select volume 4
DISKPART> remove letter=G

# To change a drive letter:
DISKPART> select volume 4
DISKPART> assign letter=H

Interactive Command Builder

Build Your Command Sequence:
Your Command Sequence:
Click buttons to build your command sequence...

Best Practices

  • Always run list disk first to verify disk numbers
  • Double-check disk selection before destructive operations
  • Back up important data before any disk operations
  • Use detail disk to verify you've selected the correct disk
  • Test commands on non-critical systems first
  • Document your disk layout before making changes

Common Mistakes to Avoid

  • Selecting wrong disk number (can destroy OS or data)
  • Using CLEAN without verifying disk selection
  • Forgetting to assign drive letter after formatting
  • Not checking for existing partitions before creating new ones
  • Attempting to extend volumes without adjacent free space
  • Running DiskPart without administrator privileges

Additional Information

Partition Types
  • Primary: Bootable partitions (max 4 per MBR disk)
  • Extended: Container for logical drives (MBR only)
  • Logical: Drives within extended partition
  • GPT: Modern partition table (128 partitions, >2TB support)
  • MBR: Legacy partition table (4 primary partitions, 2TB limit)
File Systems
  • NTFS: Default for Windows, supports large files, permissions
  • FAT32: Universal compatibility, 4GB file size limit
  • exFAT: For flash drives, no file size limit
  • ReFS: Resilient File System for servers
Pro Tip

DiskPart scripts can be automated by saving commands in a text file and running: diskpart /s scriptfile.txt

Quick Reference Card

Information Commands
  • list disk
  • list volume
  • list partition
  • detail disk
  • detail volume
Selection Commands
  • select disk X
  • select volume X
  • select partition X
Action Commands
  • clean
  • create partition primary
  • format fs=ntfs quick
  • assign letter=X
  • extend
  • shrink