The essentials
Quick reference
One focused task per row. Jump to the related section for complete, working examples.
| Use | Syntax | Examples |
|---|---|---|
| List volumes | list volume | View examples |
| Select a volume | select volume 7 | View examples |
| Inspect the selected volume | detail volume | View examples |
| List disk partitions | list partition | View examples |
| Query maximum shrink | shrink querymax | View examples |
| Shrink by up to 10 GB | shrink desired=10240 minimum=8192 | View examples |
| Extend by 20 GB | extend size=20480 | View examples |
| Use all eligible free space | extend | View examples |
| Grow filesystem to partition | extend filesystem | View examples |
| Select a partition | select partition 4 | View examples |
| Inspect a partition | detail partition | View examples |
| Delete a partition | delete partition | View examples |
| Override partition protection | delete partition override | View examples |
| Delete a volume | delete volume | View examples |
| Verify the resulting layout | list partition | View examples |
Resize operations preserve data only when every storage and filesystem prerequisite is satisfied; delete operations do not. DiskPart has no WhatIf and no transaction rollback. Capture the layout, verify a tested backup, suspend or coordinate encryption and applications, check contiguous free space, and repeat select plus detail immediately before each state-changing command.
Step by step
Detailed examples
Capture layout, health, encryption, and ownership
Map the selected volume to its disk and partition, then capture order, size, filesystem, free space, mount paths, health, BitLocker status, cluster ownership, paging, snapshots, and application dependencies. Back up and test restore. DiskPart cannot preview a resize and success does not guarantee application consistency.
list volume
select volume 7
detail volume
list partition
filesystems
rem Verify backup, encryption, cluster, pagefile, and application state outside DiskPart. Measure movable space before shrinking
Shrink querymax reports the current maximum based on movable data and filesystem constraints. The number can change while a volume is active. Shrink sizes are in MB. Desired is the requested reduction; minimum lets the operation succeed with a smaller reduction only if at least that amount is available. Do not shrink below application, recovery, or free-space requirements.
select volume 7
detail volume
shrink querymax
rem Recheck the application capacity plan before continuing.
shrink desired=10240 minimum=8192
detail volume Confirm eligible unallocated space
For a basic volume, unallocated space normally must be contiguous, immediately after the partition, and on the same disk. Supported basic volumes are generally NTFS for extension. Dynamic-volume rules differ. Extending a virtual or hardware disk container first does not automatically grow its partition or filesystem. Specify size to avoid consuming space reserved for another partition.
select volume 7
detail volume
list partition
rem Confirm 20480 MB of contiguous free space follows this partition.
extend size=20480
detail volume Reserve override for intentional rebuilds
Delete partition removes the selected partition. Override bypasses type-based protection and can destroy EFI, MSR, OEM, recovery, or other utility partitions. Never infer safety from a partition's size or missing letter. Verify its type, attributes, offset, contents, and boot or recovery role, and keep override out of general-purpose cleanup scripts.
select disk 3
list partition
select partition 4
detail partition
rem Do not use delete or override until the partition role is independently proven. Delete volumes only after removing every consumer
Deleting a volume destroys its filesystem access and may remove extents across dynamic disks. Remove it from applications, shares, backups, replication, clusters, mount points, and monitoring first. Capture all paths and volume identity. Delete volume has no override switch; an unexpected refusal often signals a protected role or dependency that must be investigated rather than bypassed.
list volume
select volume 7
detail volume
attributes volume
rem Stop services and verify an offline restore before: delete volume Validate capacity and keep rollback practical
Repeat detail volume, list partition, and list volume. Validate filesystem health, free space, mount paths, encryption state, cluster health, and application writes. A resize rollback is another risky resize and may not be possible if data movement changes; the real rollback is a tested restore or redeployment plan.
detail volume
list partition
list volume
exit
Get-Volume | Sort-Object DriveLetter | Format-Table DriveLetter, FileSystem, HealthStatus, Size, SizeRemaining Sources and further reading
References
Authoritative documentation used to verify and expand this cheat sheet.
Help us improve
Found a typo or missing example?
Tell us what would make this cheat sheet clearer, more complete, or more useful.



