Shrink your VHD size

Hello there,

Happy New Year!

We had a pretty big snow storm during the past Christmas in Seattle area. Wherever you are, I hope you had a safe and relaxing Christmas and / or New Year holiday!

If you are still new to VMM, today I'm going to show you a tip on how to "shrink" your VHD size - one of the challenges to virtualization beginners. As you may know, one of the major benefits of using VM is that it allows users to change the virtual hardware without having to tear down a system and rebuild from scratch. I’ve got a few inquiries from customers about how to shrink their VHD size.

Here is how you can shrink a dynamic disk type VHD by using SCVMM 2008. What you need to do is:

  1. First delete snapshots if you have and wait till merge to complete.
  2. Once merge is complete, issue compact vhd from the VM Properties (see screenshot below):
  3. You can also do this from the PowerShell layer by using Compress-VirtualDiskDrive cmdlet. For the actual syntax, use command “get-help Compress-VirtualDiskDrive –detailed”.
  4. If your VHD is fixed type instead of “dynamic” type, you can convert it to dynamic type first, and then compress it. The conversion of the disk type can be done in the same UI or by using cmdlet “Convert-VirtualDiskDrive”.

 

Thanks for reading and hope this helps.

Cheers,
Cheng