Cheng's Random Thoughts on System Management

Senior Program Manager, MSD

Shrink your VHD size

Shrink your VHD size

  • Comments 3
  • Likes

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

Comments
  • I have a question. If you have a fixed disk and want to compact it, the only way to do this is to convert to a dynamic disk and then compact it? Are there any other ways? Also, I've always heard best practice for disk performance is to keep the disk as a fixed disk. If I had a fixed disk, could I convert to a dynamic disk, compact it and then convert back to a fixed disk. Would this method work? Thanks.

    P.S. - Could you respond with an answer to metalli445@comcast.net. Thanks Again

    Pat

  • I have the same question as Pat, will this work ?

    "If you have a fixed disk and want to compact it, the only way to do this is to convert to a dynamic disk and then compact it? Are there any other ways? Also, I've always heard best practice for disk performance is to keep the disk as a fixed disk. If I had a fixed disk, could I convert to a dynamic disk, compact it and then convert back to a fixed disk. Would this method work?"

    Cheers

    Dave

  • hi i got a dynamic hard disc, starting the size is 32kb after using the hard disc it expanded to 3gb, max capacity i have given is 10gb  . presently my hard disc got 1gb of contents when i check the property of the hard disc from the main machine the size shows 3gb. i want to free up the space and make the size of the hard disc to 1gb without deleting the contents ..

    please suggest me the best way to do

    my email id is : kpaniraju@rediffmail.com

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment