Posey's Tips & Tricks

Create a Backup Plan for Your Backups with Hyper-V Replica

Backup solutions are more reliable now than they've ever been, but it's still important to have a second data-protection measure in case your backup fails. That's where Hyper-V comes in.

As someone who has worked in IT for 30 years, I have seen a lot of changes, some good, some bad. One of the best has been that backups are far more reliable than they once were.

Early in my IT career, it was common practice to create multiple backups in parallel, because you never knew if you were actually going to be able to restore a backup or not. Having a secondary backup to fall back on was absolutely essential.

Even though today's backup hardware and software are much more reliable than those from long ago, I still think it's important to have a secondary mechanism to fall back on in the event that your backup fails to restore properly. After all, backups are your last line of defense against data loss. If you are restoring a backup, it means that other efforts to revert data to a previous state have failed. As such, hedging your bets with a secondary solution is never a bad idea.

In my own organization, I use Hyper-V replica and some related features as a secondary protective measure. I use third-party backup software to create backups just like everyone else does, but I use some of Hyper-V's native capabilities to ensure I can get my data back in the event that I have trouble restoring a backup.

If you aren't familiar with Hyper-V's replica feature, it is a native feature that you can use to create asynchronous virtual machine (VM) copies. Hyper-V can replicate a running VM to a replica server -- and to an off-site Hyper-V host -- and keep the replica VM copy in relatively close synchronization to the running VM. The idea is that if the primary Hyper-V host were to fail, the VM replica can be brought online on another host. This allows mission-critical applications to be brought back online immediately, with minimal (or possibly no) data loss.

Hyper-V replication is really intended to be a business-continuity feature. It was never intended to act as a backup alternative. Even so, the replication feature has some backup-like characteristics. After all, Hyper-V is copying virtual hard disk files from one server to another and, like a backup, these copies can be used to put things back to normal if it becomes necessary to do so.

Realistically, the Hyper-V replica feature has two capabilities that allow it to augment your backups. The first of these capabilities is its ability to create multiple recovery points. If you find yourself having to activate a replica, the best option is usually to use the most current data. However, you can opt to activate a replica from a previously created recovery point if you need to revert the VM to an earlier state.

You can find the option to create replica recovery points by opening the Hyper-V Manager, right-clicking on the VM that you are replicating and choosing Settings from the shortcut menu. Now, scroll through the console tree until you find the Replication section. As you can see in Figure 1, this section provides an option to create hourly recovery points, as well as an option to create periodic VSS snapshots.

[Click on image for larger view.] Figure 1: You can configure Hyper-V to create hourly recovery points.

The other feature is Hyper-V's ability to create a test failover. A test failover allows you to run a replica VM in a sandboxed environment to validate the replica. However, you can also use this ability to create an offline backup. Here's how it works.

Log onto a replica host, open Hyper-V Manager, then locate the replica VM that you want to back up. Right-click on the VM and choose the Replication | Test Failover options from the shortcut menus, as shown in Figure 2. When you do, you will be prompted to choose the recovery point that you want to use. Make your selection and click the Test Failover button.

[Click on image for larger view.] Figure 2: Right-click on the replica VM and choose the Replication | Test Failover options from the shortcut menu.

Even though you are performing a test failover, Hyper-V must continue to keep the replica in sync. It does this by redirecting all write operations to a differencing disk. This means that the virtual hard disk file becomes read-only, allowing you to safely make copies of it. If you look at Figure 3, you can see the read-only virtual hard disk files (they have names like H, I and M on my server), as well as all of the virtual hard disk files that are now intercepting write operations (the AVHDX files). You can also see the files used by the various recovery points.

[Click on image for larger view.] Figure 3: This is what the Virtual Hard Disks folder looks like during a test failover.

To create an offline backup, simply make a copy of the read-only virtual hard disk files. In Figure 4, for example, I am copying a virtual hard disk file named M.VHDX from my Hyper-V replica host to an external physical hard disk. When the backup is done, I will simply disconnect the external disk and store it somewhere safe.

[Click on image for larger view.] Figure 4: I am creating a backup copy of M.VHDX.

My normal backup software continues to function in the normal way throughout this process. This technique simply creates an offline secondary backup copy that can be used in the event of an emergency.

About the Author

Brien Posey is a 22-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.


comments powered by Disqus

Subscribe on YouTube