Can I shrink a volume from the command line?

John Savill

June 12, 2007

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. Yes. The Diskpart tool has a Shrink command. With no parameters, this command shrinks a disk by the maximum amount possible. For example:

DISKPART> select disk 0
Disk 0 is now the selected disk.

DISKPART> select part 1
Partition 1 is now the selected partition.

DISKPART> shrink
DiskPart successfully shrunk the volume by: 14GB

However, you might not want to go this route. To discover the maximum space by which you can shrink a volume, use the Shrink Querymax command. For example:

DISKPART> shrink querymax
The maximum number of reclaimable bytes is: 16GB

To perform a shrink to a certain amount, add the desired parameter with the number of megabytes by which to shrink. You can also add a minimum parameter, which forces the command to fail if that amount of space isn’t available. For example:

DISKPART> shrink minimum=20000
The specified shrink size is too large.

DISKPART> shrink desired=1000
DiskPart successfully shrunk the volume by: 1000MB

You can use a combination of parameters, too. So, if you specify “desired=5000 minimum=2000,” the tool will attempt to shrink by 5GB, but as long as it can shrink by at least 2GB, the command will execute successfully. See also, "Q: How do I shrink a volume in Windows Vista?"

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like