Running virtualized environment is so convenient that at times you may even forget that hardware on which all your VMs are running or Hyper-V host may need to be restarted… At this point reasonable question to ask is “What will happen with my VMs during host restart?” If we set aside clustered high-available Hyper-V implementations what actually will happen is defined on a per VM basis in VM properties (for stand-alone Hyper-V servers not participating in Hyper-V cluster or managed by SCVMM). Options which define this behavior on a per VM basis called “Automatic Stop Actions” and “Automatic Start Actions” respectively.
By default your running VM will save state & start automatically after reboot if they were started before Hyper-V restart. See screenshot of corresponding VM Settings section below.
As for other options you may configure in VM properties these are “Save the VM state (default)”, “Turn off the VM”, “Shut down the guest OS” (Automatic Stop Actions) and “Nothing”, “Automatically start if it was running when the service stopped”, “Always start this VM automatically” (Automatic Start Action). In Hyper-V v3 (part of Windows Server 2012) even more additional VM startup control options available to address “VM boot storms” and some other related issues (e.g. you may set startup memory allocation to be greater than memory allocated to VM when it up and running)…
As for logging you may find loads of Hyper-V related events under in Event Viewer > Applications and Services Logs > Microsoft > Windows. In particular when you shutdown your Hyper-V host event 14100 is recorded in Hyper-V-VMMS > Admin logs (“Shut down physical computer. Stopping/saving all virtual machines…”), and if you just Stopped VM Management Service via Stop button in Hyper-V management console then event 14090 is being registered in the same section (“Virtual Machine Management service is shutting down while some virtual machines begin running. All running virtual machines will remain running with no management access”).
And yes after you know that your second question naturally would be about conrolling VMs stop / start up order. There is no easy few click solution for this on stand-alone Hyper-V, but it’s doable. You may find one example of ordered VMs startup solution by John Savill on windowsitpro.com, and I believe you may find more options for that.
Nice and helpful post. Can please tell me that: what happens when VM is restarted and migrated from one physical host to another specially in IaaS cloud environment. Means when VM is migrated and restarted it boots on different host platform. On booting on different platform will its boot time components such bios, loaders etc be changed or remain same? Thanks
Well Hyper-V provides you with level of abstraction which supposed to isolate you from real hardware by providing virtual hardware of different types. But in fact depending on virtual hardware type and migration scenario it might be required to have matching physical hardware configurations anyway. E.g. for the sake of performance VMs usually got more and more “direct” access to some hardware and this is obviously may require matching hardware on the hosts when you migrate VMs between them. For better understanding of virtual hardware and its types you may give a read to following article: http://www.altaro.com/hyper-v/hyper-v-virtual-hardware-emulated-synthetic-and-sr-iov/
Thanks for the helpful post. But you might want to update your included image URL to /wp-content/uploads/2013/01/hyper-v_auto_stop.jpg?w=300 which works, instead of the private network URL which doesn’t: //192.168.1.2/wordpress/wp-content/uploads/2013/01/hyper-v_auto_stop.jpg?w=300just a thought. 🙂
@Andrew, thanks for flagging this – fixed it now. What you noticed it just some remnants of my experiments with move from wordpress.com to my own server…
Nice articleMy one of VM’s in Hyper-V is in OFF state. Where I can get the log to find the reason/root cause of changed state?
Somehow I forgot to answer your question when it come, and bump into it again now 🙂 I think you have to look at Hyper-V-VMMS log and events logged there. Please also see this blog post covering Hyper-V logging: https://blogs.technet.microsoft.com/virtualization/2018/01/23/looking-at-the-hyper-v-event-log-january-2018-edition/
TO be honest most of the time when this happens it could be caused by the Virtual Network. If you create a virtual network and then when creating a new VM select the newly created virtual network , then add the VHD file later, the VM will start to work. this might happen after you install new network drivers