Shrink/Compact vDisk VHD file

When creating a new vDisk, there is a question if you want the file to be dynamic or fixed. When choosing dynamic, the size of the VHD file would grow when demanding more space. Until the size has reached the size of the disk. In my environment I have a dynamic vDisk from 60GB. The VHD file size is 30GB. When deleting files from the vDisk this size doesn’t shrink.

image

Now open an elevated command prompt en start diskpart.

Select the vDisk with the following command: select vdisk file=”<VHD FILE>”

image

To shrink/compact the VHD file give the following command: compact vdisk

image

Now (in my case) the file is the smallest size possible. (hmmm I should have delete more files Knipogende emoticon)

image

Only Windows 2008 and be sure that the vDisk isn’t in use Knipogende emoticon

Update: You can use SDELETE (http://blog.it-ic.nl/wordpress/?p=318) to shrink the VHD even more.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top