10

I am fairly new to using Hyper-V. I am trying to learn the best practice for shutting down and restarting my server when virtual machines are running on it.

I have a physical server running MS Windows Server 2012 R2. I have two Virtual Machines running under Hyper-V on this Windows server. One VM is running a guest operating system of Windows 7 Professional. The other VM is running Ubuntu 14.10.

My question is, do I need to shut down each virtual machine before shutting down the physical server or will the virtual machines be shut down by the physical server as part of its shutdown?

I have not been able to find any information on this process. Can anyone point me in the right direction?

Thank you

BitBug
  • 237
  • 1
  • 5
  • 13

4 Answers4

14

It depends on how your configured your Virtual machines.

If you have your VMs configured to 'Turn OFF', then shutting down the host OS would be close to equivalent to pulling the power from the VMs. If your VMs are configured this way, and you want them to safely shutdown, then you need to shut them down first. You could also use the other options like suspend, or shutdown the guest OS.

Do keep in mind that the shutdown the guest, requires that you have guest additions properly installed on the guest. I believe without them, you will have the 'turn off' effect, but I am not certain.

hyperv shutdown

Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • Very helpful and gave me exactly what I needed. – BitBug Apr 10 '15 at 22:39
  • 1
    I'm no expert in Hyper-V specifically, but it seems logical that either “Turn off the VM” or “Save the VM state” would be possible without any additions.  I mean, “Save” shouldn't be more complex than freezing the virtual FS & CPU, saving off the RAM and CPU registers, and maybe some other state info (GPU? virtual network/bus devices?).  Your screenshot (the warning appears only on the third option) and @dbwillis's answer seem to support this assumption. – Slipp D. Thompson Apr 11 '15 at 05:13
  • 1
    I have seen problems with software in some guests in a suspend state. Particularly stuff needing correct time. Without guest additions to correct time on resume, things can get a bit wonky. So you may not need them for the guest to suspend/resume, you really do want them so you guest OS will be stable. BTW, notepad isn't the best test here. – Zoredache Apr 11 '15 at 08:07
  • Any good way to test if `Guest Additions` is installed and property working? I think MS calls them `Integration services` and whether they are installed is visible in Windows Admin Center's `Integration services version` section. But having this field populated might not mean that all is working fine... – NoOne Mar 21 '21 at 23:59
2

In my tests, no, the VM's do not need to be shut down. I actually tested this by having notepad open on a VM, with unsaved text, then restarted the host.

The VM came back up with the notepad open, with the text there.

I think under HyperV settings there is a default option to 'do this to VM when restarting'

dbwillis
  • 29
  • 1
  • 2
    This is describing only a single condition/action for the VM Automatic Shutdown settings when shutting down the host. There are three possible conditions/actions for dealing with a VM when shutting down the host. – joeqwerty Apr 10 '15 at 21:47
2

I prefer to go through the process of shutting them down individually through the management console. While fairly rare, there are times the VM state has an issue or won't shut down properly on it's own. This gives me a chance to make sure all of this happens in the manner that I expected. Not to mention, there are times that the VM itself doesn't always release RAM depending on what systems are running on it, and while often it doesn't really do anything, it makes me feel better for some reason.

BitBug
  • 237
  • 1
  • 5
  • 13
user356865
  • 21
  • 1
1

It seems that the default setting is saving system state. So my take is that individual vm need not be shut down if the default setting is used.

David K.
  • 11
  • 1