Virtual machine backup with Hyper-V

Regardless of which virtualization platform you use, virtual machine backup poses challenges, such as how to retrieve individual files. An expert explains how to back up VMs using Microsoft's Hyper-V.

Backing up servers has never been easy, but at least in the past you could say that the process was trivial. These days though, with the introduction of virtualization into server environments, it's apparent that this new technology makes backups ever more complicated while at the same time making them more reliable. In this tip, I'll examine how to execute Hyper-V backups by explaining its features and point out a few common problem areas as well.

Server backups with Hyper-V
Think about the two different ways in which virtual machines (VMs) can be backed up. The traditional way for doing this requires installing a backup client into the VM and backing up the VM in much the same way you would with a physical machine. This VM backup technique is great when you need to restore individual files, but is of little help if you need to restore an entire machine. Moving to a virtual infrastructure adds the capability to back up an entire virtual machine effectively as a single file. With many of the platforms on the market this means that an entire machine is easily and reliably restored, but getting back individual files is a pain in the neck.

Hyper-V is no different. In fact, Hyper-V comes equipped with integrations such as Windows' Volume Shadow Copies Service (VSS) that makes backing up a machine even more effective than with most other virtualization platforms. This is due to the fact that even with the capability for doing single-file, entire-machine backups using virtualization, the process by which that entire-machine backup works doesn't correctly quiet on-board transactional databases during the period of the backup.

This means that an entire-machine restore of a virtual server which hosts databases like Exchange, SQL or Active Directory is likely to come back with that database in an inconsistent state. The integration of VSS eliminates that problem with Hyper-V by integrating a VSS-aware backup client on the host with VSS writers in the virtual machine's operating system. The result is a complete and consistent backup of even the most complex transactional databases.

Implementing VSS for backups in Hyper-V
Hyper-V, being the newest player in virtualization, still has a few idiosyncrasies when it comes to making use of VSS. First and foremost, admins who want to take advantage of this feature must use a VSS-aware backup client. Most enterprise backup clients these days support this capability, but definitely check your support list first.

If your environment doesn't have a VSS-aware backup solution, you can elect to use Microsoft's built-in Windows Server Backup. This Windows Server 2008 "feature" is installed via Server Manager and provides a mechanism for backing up a Hyper-V host server and all of its resident VMs. Note that if you plan to use Windows Server Backup, it is currently limited to backing up entire volumes. In order to make use of its VSS-aware features, you can only back up and restore an entire volume at a time. This can be a major problem if one of your VMs malfunctions and you only need to bring that specific VM back to life.

Regardless of what backup client you choose for your Hyper-V hosts, to turn on VSS-aware backups you'll need to ensure a few things:

  • Hyper-V integration components must be installed and functioning in each running VM. You can verify that the Backup Integration Service is installed and running in each VM through the Hyper-V or SCVMM console.
  • The VSS service must be running on all volumes used by the virtual machine, with the specific configuration that each volume must use itself as the storage location for its shadow copies. Thus, the C: drive must use the C: drive as its location for shadow copy storage.
  • If you're using Windows Server Backups, a registry key must be set on the Hyper-V host to enable VSS support. In the location HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\Application Support\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}, set the REG_SZ value for Application Identifier to Hyper-V.
  • Virtual machines that make use of dynamic disks cannot be backed up via VSS. This is yet another reason why you should never use dynamic disks, well, anywhere in your environment. Also, all disks must be formatted New Technology File System (NTFS).
  • A VSS-aware backup requires the use of a snapshot to complete its work. As such, virtual machines that have two or more snapshots in place will later fail in the attempted restoration of their backups. To this end, since snapshots can have a negative impact on VM performance, it is a best practice to ensure that your VMs do not have attached snapshots.

Pain points in Hyper-V backups
There are a number of gotchas you should be aware of when it comes to backups. These are not obvious, and can impact where you position your backup clients (On the host versus on the VM versus in both locations). Consider the following:

  • Be careful with the use of network-attached storage for your virtual machines. Storage such as iSCSI must be up and available during the backup for the backup to succeed.
  • Data that is stored on a pass-through disks within a virtual machine cannot be backed up by the Hyper-V VSS writer.
  • Any iSCSI LUNs that are directly connected into a virtual machine's operating system cannot be backed up. Thus, if you have a separate iSCSI connection in your VM to remote storage, you'll need to back up that data either directly off your data store or using a backup client in the virtual machine.
  • Hyper-V has some compelling features for virtualization and virtual backups, but it certainly is not without a few caveats. As a version 1.0 release, however, one can argue that Hyper-V's strong VSS support outweighs its limitations.

ABOUT THE AUTHOR:Greg Shields, MVP, is a co-founder and IT guru with Concentrated Technology (www.concentratedtechnology.com) with nearly 15 years of IT architecture and enterprise administration experience. He is an IT trainer and speaker on such IT topics as Microsoft administration, systems management and monitoring, and virtualization. His recent book Windows Server 2008: What's New/What's Changed is available from SAPIEN Press.

Dig Deeper on Microsoft Hyper-V and Virtual Server