Tip

Microsoft's Hyper-V snapshots offer quick VM backups, but with limits

Microsoft’s Hyper-V snapshots offer a quick way to back up virtual machines during upgrades, but they’re no substitute for long-term archives.

What you will learn in this tip: Although not a substitute for traditional backups, Microsoft Hyper-V snapshots provide a quick and easy way of creating a pseudo-backup for virtual machines (VMs). In this tip, you'll learn how to create a Hyper-V snapshot, and when it is and is not appropriate to use the snapshot feature.

Hyper-V snapshots can be useful for backup administrators, particularly in situations in which an administrator needs to apply a service pack or make a major configuration change to a virtual server. Assuming that the virtual server isn’t acting as a database server, the administrator can make a snapshot prior to performing the operation. Once the operation has been confirmed a success, the snapshot can be deleted by right clicking on the snapshot and choosing the Delete command from the shortcut menu.

Creating a Hyper-V snapshot

Creating a snapshot in Hyper-V is an extremely easy process. To do so, open the Hyper-V Manager, right click on the VM for which you want to create a snapshot, and choose the Snapshot command from the shortcut menu. You can see an example of this in Figure 1 below.

Figure 1: Creating a snapshot

Click here to enlarge Figure 1.

Right click on a virtual machine and select the Snapshot command.

Once a snapshot has been created, a snapshot tree appears beneath the listing for the VM within the Hyper-V Manager. This snapshot tree is for all practical purposes a backup of the VM that can be used to revert the VM back to its state when the snapshot was made. To restore the VM from the snapshot tree, simply right click on the VM and choose the Revert command from the shortcut menu, as shown in Figure 2 below. If you look beneath the list of VMs in the figure, you can see the snapshot tree for the selected virtual machine.

Figure 2: Choosing the revert command

Click here to enlarge Figure 2.

You can revert a virtual machine to a previous state by right clicking on the virtual machine and choosing the Revert command from the shortcut menu.

The disadvantages of Using Hyper-V snapshots

As you can see, Hyper-V makes it simple to create and restore snapshots. Throughout this tip, however, I have referred to snapshots as a sort of pseudo-backup. The reason for this is that snapshots are not a substitute for traditional backups. In fact, Microsoft recommends using snapshots sparingly because there are several disadvantages to using them.

The first disadvantage with using Hyper-V snapshots for backup is that the files are stored locally, and do not provide protection against storage failure because they are usually stored on the same volume as the files that they are designed to protect.

When you create a snapshot, Windows creates a special type of virtual hard disk file (an .AVHD file). If you look at Figure 3 below, you can see that Hyper-V has created a folder for the virtual server Lab-DC. Within this folder is a sub folder called Virtual Hard Disks and a parallel sub folder called Snapshots, where the .AVHD files are stored.

The .AVHD file consumes hard disk space that may be needed by other virtual hard disk files. Remember that Hyper-V uses dynamically expanding virtual hard disk files by default, so it is important to always leave plenty of free disk space.

Figure 3: Snapshots are stored locally

Click here to enlarge Figure 3.

Snapshots consume space on the volume containing the virtual hard disk files.

Another reason to use snapshots sparingly is because snapshots can greatly impact the virtual server’s performance. When you create a snapshot, you are not actually creating a copy of the VM. Instead, Hyper-V freezes the virtual hard disk file and creates a new virtual hard disk (the .AVHD file that was mentioned earlier). All subsequent write operations are made to this virtual hard disk file.

This approach has a tremendous effect on read operations. When a read is required, Hyper-V checks the .AVHD file to see if it contains the requested data. If the data is not found in this file, then the data is read from the original virtual hard disk file. The effect on performance is compounded on machines containing multiple virtual hard disk files because each file must be searched individually until the requested data is located.

An additional problem with using snapshots is that they don’t work very well for database servers. When a virtualized database server is rolled back to a snapshot, the server will lose any transactions conducted since the creation of that snapshot. This can be a big problem if other systems are connected to the database and have already performed operations based on the data that is lost during the rollback. Microsoft forbids snapshots to be used with virtualized Exchange mailbox servers because of the effect that the snapshots can have on the mailbox databases.

As you can see, Hyper-V snapshots can provide a fast backup of a VM, but they're no substitute for traditional backups, and there are certain situations as described above where they don't work very well.

About the author: Brien M. Posey, MCSE, has previously received Microsoft's MVP award for Exchange Server, Windows Server and Internet Information Server (IIS). Brien has served as CIO for a nationwide chain of hospitals and was once responsible for the Department of Information Management at Fort Knox. You can visit Brien's personal website at www.brienposey.com.

Dig Deeper on Cloud backup

Disaster Recovery
Storage
ITChannel
Close