Posey's Tips & Tricks
Patch Management for Hyper-V Replica Hosts
Even though Hyper-V's replica feature does not provide true high-availability the way that a failover cluster does, you can use your replica infrastructure to minimize the disruption caused by the patch management process. In this column, I will show you how it's done.
If you look at Figure 1, you can see that I have a Hyper-V host running one virtual machine (VM). As you can see, however, Windows is prompting me to install a cumulative update for Windows Server 2016. Installing a cumulative update requires a host to be rebooted, which would normally cause any VMs running on the host to become unavailable until the host is back online. In this case, though, the VM is being replicated to another Hyper-V host.
The fact that the VM is being replicated to another host on my network means that there is a full copy of the VM residing on another host. I can run the VM from this copy while the VM's current host is being patched.
Because the VM is running on a replica pair and not a failover cluster, I can't simply reboot the host and expect the VM to failover to an alternate host. What I can do, however, is manually initiate a failover before beginning the patch management process.
Now, it's worth noting that this process does not allow you to keep the VM online. Before you can perform a planned failover, you will have to shut down the VM. Given the amount of time that some updates take to install, however, it is probably going to be less disruptive to shut down the VM, perform a planned failover and bring the VM back up than to shut down the VM and leave it down while the host is being patched.
To failover a VM to a replica host, begin by shutting down the VM. Once the VM has been powered off, right-click on the VM and select the Replication | Planned Failover commands from the shortcut menus. You can see what these menu selections look like in Figure 2.
At this point, you will see a screen detailing the steps that will be taken as a part of the planned failover. As you can see in Figure 3, this involves making sure that the VM is off and that all of the VM's data has been replicated to the replica server.
To initiate the failover, click the Fail Over button shown in the figure above. The failover process usually only takes a few seconds to complete, and the VM is automatically started on the replica host as part of the failover process. You can see what this looks like in Figure 4.
Once the failover has completed, the Hyper-V host can be patched. Although you can pause the replication process while the patch is being applied, doing so isn't usually necessary. If you have reversed the replication direction, then the replicas will be kept in sync while the updates are being downloaded.
When the update process completes, the next step in the process is to fail the VM back to its original host. Technically, the VM can run off either host for an indefinite period of time, but a failback is usually desirable so that the other host can be patched.
Failing back works in exactly the same way as the initial failover. Just shut down the VM, then right-click on it and choose the Replication | Planned Failover commands from the shortcut menus. When prompted, click the Fail Over button, and the VM will failover to its original host and then start up.
With the VM up and running in its original location, you can now patch the replica host. You won't have to worry about initiating a failover when patching the replica host because the replica VM is not running.
Brien Posey is a 21-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.