Clearing unused space from a virtual hard disk

If you’re using Hyper-V, and you have a dynamic virtual hard disk (VHDX), then when you delete files from it, the file size won’t shrink automatically.

A great, quick way of getting things downsized is here: https://fiddley.wordpress.com/2014/01/27/dynamically-expanding-vhd-not-compacting-in-hyper-v/

Specifically:


Run an administrative command prompt
Type “Diskpart” (No Quotes)
Type the following commands:
select vdisk File=”I:\path\to\your.vhd”
attach vdisk readonly
compact vdisk
detach vdisk

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s