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.
Now open an elevated command prompt en start diskpart.
Select the vDisk with the following command: select vdisk file=”
To shrink/compact the VHD file give the following command: compact vdisk
Now (in my case) the file is the smallest size possible. (hmmm I should have delete more files )
Only Windows 2008 and be sure that the vDisk isn’t in use
Update: You can use SDELETE (http://blog.it-ic.nl/wordpress/?p=318) to shrink the VHD even more.