A client of mine called me the other day – “My VM is taking a lot of disk space on the Hyper-V server. More than it should”. When I connected to the server I’ve identified the reason immediately.
You see, in previous versions of Hyper-V (2008 and 2008 R2) when you created a VM and booted it, Hyper-V would automatically create a file with BIN extention. That file was created with the same size as the VM’s memory. The file is created so that Hyper-V would have enough space on the disk to store the VM’s memory in case you place it in Save State place.
With the release of Hyper-V 2012 Microsoft have decided to give you the option of disabling this file – but it comes with a price. You have the option to configure what happens to a VM when the Hyper-V hosts has to shutdown/restart – either Save State the VM, Turn it off or Shut it down. If you choose to Save State it – the BIN file will be created. Other-wise – no BIN file.
My suggestion here is to take into consideration everything before you decide this.
When you set a VM to Save State and you initiate Hyper-V server reboot:
1. Hyper-V Save States the VM and all work is paused and saved.
2. This operation happens a lot faster than Shutting down the VM which means the Hyper-V hosts reboots faster.
3. Once Hyper-V host starts the VM is simple “resumes” its operation where it was left – faster VM resume than booting it.
You can configure this setting using the Hyper-V Manager or by PowerShell (which way do you think I like best?)
Using Hyper-V Manager open a VM’s settings and choose ‘Automatic Stop Action” under ‘Management”. There you can set the setting you would like:
Using PowerShell is the easiest way of-course. Using the Set-VM command you can set what happens to a VM when the Hyper-V hosts is rebooted:
Set-VM -AutomaticStopAction Save Or Set-VM -AutomaticStopAction Shutdown