QuickTip: Hyper-V Automatic Stop Action settings to save disk space


In Hyper-V versions prior to Windows Server 2012, a .bin file was created for each virtual machine, that was the exact same size as the memory allocated to the VM.  This was to automatically reserve the disk space needed if you ever saved the state of the VM.  It ensured that if you needed to save the state of all your VM’s, you would have enough disk space to do so. 

In 2012, the behavior changed.  We only create the .BIN file (with the size pre-allocated to RAM size) IF the VM settings for Automatic Stop Action are set to “Save the Virtual Machine State”  (which happens to be the default).

image

However, in the case of highly available clusters, we’d prefer to live migrate VM’s, and would not inadvertently shut down a host node, so this storage requirement really isn't as necessary.

Additionally, if you are using Hyper-V for labs, or test/dev scenarios where disk space might be very constrained, you might consider setting this default stop action to “Shut Down the Guest Operating System”, and save yourself a potential amount of disk space.

If your server has 64GB of RAM allocated to VM’s, this means you are consuming 64GB of additional disk space for these save-state files.  That might not be significant to you, but in my environment, where all my VM’s run on SSD drives, every single GB is precious!

Here is an example of the .bin file:

image

You can change the setting manually for each VM, or here is a one-liner PowerShell command that will make the changes for you.  This setting requires the VM’s be shut down to make the change:

get-vm | set-vm -AutomaticStopAction ShutDown

Here is my disk consumption prior to the changes.  Not the free space available on my SSD drives:

image

And after:

image

That frees up a nice chunk of real estate for additional density on these super-fast solid state volumes!

For additional reading on this – the PFE platforms team has a great blog with Hyper-V best practices:

http://blogs.technet.com/b/askpfeplat/archive/2013/03/10/windows-server-2012-hyper-v-best-practices-in-easy-checklist-form.aspx

And any Hyper-V enthusiast or administrator should always follow Aidan’s blog as well, he also commented on this post above:

http://www.aidanfinn.com/?p=14288

Comments (0)

Skip to main content