Hyper-V VHD compression help

I have windows server 2008 standard R2 with hyper v installed. I have 4 hyper V machines running. I know the only way to regain the free space from the VHD to match the server is to compress it. Is there a rule of when you should compress the VHD? Meaning don't do it when its a certain size or don't let it get to a certain size?

Thanks
IT_FanaticAsked:
Who is Participating?
 
kevinhsiehCommented:
I think that you look at how much space is available to be reclaimed, and whether or not that is significant enough for the hassle of compacting a VHD. To try to get an idea of how much space can be reclaimed by compacting, look at what the VM tells you for disk space used/available, and compare that to the actual size of the VHD. If your VHD is 15 GB physically but the OS says that only 10 GB is used, you then have the opportunity to get back up to 15 GB by compacting the VHD.

I usually only compact a VHD if I am turning a VM into a template, or if I just removed a bunch of data and I know that there is a significant amount of space the can be reclaimed by compacting the VHD.
0
 
Sid_FCommented:
I'm not aware of any issues on size other than the time it will take to compress. Have a look at the zerodata tool mentioned here http://msmvps.com/blogs/anguslogan/archive/2004/10/03/14756.aspx
0
 
kevinhsiehCommented:
My experience under Hyper-V R2 is that precompaction isn't needed, at least for Windows VMs. Notice that the precompaction tool that shipped with Virtual Server 2005 isn't included with Hyper-V. My guess is that the VHD compaction routine looks at the NTFS structures within the VHD to find the actual data to be copied.  
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
IT_FanaticAuthor Commented:
That is inaccurate. Hyper V manager doesn't compress automatically a VHD that is setup for dynamic. You will have to turn off that VM and then use hyper v manager to compress the VHD to regain free space
0
 
kevinhsiehCommented:
I was talking about the pre-compaction utility that shipped with Virtual Server that was needed to defragment (and possibly zero out) the VHD before VHD compaction. You still need to turn off the VM in order to compact the VHD. There isn't a supported specification for compressing a VHD, but rather to compact a VHD, which essentially removes all of the white space in a VHD in order to make the file physically smaller. Nothing is actually compressed.
0
 
IT_FanaticAuthor Commented:
Regarding this topic I wanted to know if there is a certain rule of size of when and when not to compress to get my space. I haven't really found anything online that talks about it.
0
 
IT_FanaticAuthor Commented:
So basically there is no rule. You just look and the HDD from the VM and compare it to the VHD and see if its worth the time to compress?
0
 
kevinhsiehCommented:
Yes. Ask 100 admins you'll get 101 different answers. :-)
0
 
IT_FanaticAuthor Commented:
Thanks for your response. You clarified what I have always thought.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.