Planned or unplanned failover with Hyper-V Replica?

As you hopefully know – I have been running Hyper-V Replica in my house for about a year now.  In this time I have had a couple of instances when I had to take a step back and ask myself if I wanted to do a planned or an unplanned failover of a virtual machine.

To bring everyone up-to-speed here:  planned failover of replicated virtual machine involves logging into the source computer, shutting down the virtual machine that you want to failover, and then selecting to perform a planned failover.  Hyper-V will ensure that the two virtual machines are completely in sync and will orchestrate the process in a way that ensures no data loss.  Unplanned failover is where you go to the recovery site and just power up the virtual machine, incurring some amount of data loss in the process.

At first glace, you would assume that you always wanted to do a planned failover if possible.  But in my experience there are times when a planned failover is possible, but an unplanned failover is preferable.

Let me explain with a real-life situation I had to deal with.

One morning as I am about to leave for work – my wife calls out to me and says that the Internet isn’t working.  I duck into my little server room and look around.  Sure enough one of my Hyper-V servers is off, and will not turn on.  5 minutes later I have confirmed that it is a failed power-supply, I have replaced the power-supply, and I am booting the server.

Now, the replacement power-supply that I grabbed is not server grade (it is an old desktop power-supply that I had sitting on a shelf).  So my initial thoughts were:

    1. I will boot the server off of this power-supply
    2. I will use Hyper-V replica to perform planned failovers of the virtual machines
    3. I will then leave the server (with no active virtual machines on it) running through the day.  If it fails, it is not the end of the world.
    4. I will grab a new power-supply today and install it tonight

As I started working on this plan – my head was starting to do some math.  All up this would not take long, probably 15 minutes – but I was already late for work.  Furthermore; the virtual machines had all been turned off since the power-supply failure had happened – so there really wasn’t any significant data that would not have been replicated.  Finally, all the virtual machines that had been on the failed physical server were largely stateless (firewall, VPN, etc…) my fileserver virtual machine had been on the other server.

Once I put all of these facts together I realized that I could just leave the failed server off and perform an unplanned failover on each of the virtual machines.  This would take under 5 minutes and I would be on my way.

Which was exactly what I did.

You may be wondering if this would cause problems when I tried to startup the failed Hyper-V server later in the day (with duplicate virtual machines and the like) but this is something that Hyper-V handles for you automatically.  When I did replace the power-supply and start up the physical computer, Hyper-V detected that the replica virtual machines were running and did not start the primary virtual machines.

I did have to go in and manually correct the replication relationship when I got all my hardware up and running – but using unplanned failover provided me exactly the functionality I needed, while minimizing the amount of time that I had to spend getting my virtual machines up and running.