When thinking about backing up Hyper-V workloads, we want to consider the mechanisms that can be used to perform the backup of the virtual machines. Hyper-V can use two means for backing up virtual machines – the “saved state method” and the “child VM snapshot” method. Let’s take a look at Hyper-V backups saved state vs child VM snapshots, why one is used as opposed to the other, and which one is typically preferred for capturing virtual machine backups in our Hyper-V environment. Also, we will look at considerations with Hyper-V and Windows updates that are applied.
Hyper-V Backups Saved State vs Child VM Snapshots
As mentioned the two mechanisms that can be utilized are the saved state and the child VM snapshot methods. Let’s start with the “saved state” backup mechanism. The saved state mechanism is the default method that Hyper-V uses for backups. In other words, if no other means is requested or the virtual machine does not qualify for the child VM snapshot method, the saved state mechanism is used.
A “saved state” virtual machine backup is also referred to as an “offline backup” as it requires at least a brief bit of downtime for the virtual machine. Saved state means that Hyper-V VSS writer places the virtual machine in a “hibernated” state. When the saved state method is requested the VM is placed in saved state during the PrepareForSnapshot event. Snapshots are taken of the appropriate volumes and then the virtual machine is then returned back to the previous state which is handled with the PostSnapshot event.
The saved state method generally translated into a couple of seconds or more where the virtual machine is not responsive while the PrepareForSnapshot event is underway.
A saved state backup is not “application aware” so is not transactionally consistent. They are generally not recommended for production backups due to the aforementioned reasons:
- Requires downtime of the virtual machine
- Are not application aware
Child VM Snapshot
The “child VM snapshot” method is the preferred way for a backup solution to backup a Hyper-V virtual machine. However, there are certain requirements that must first be met before the child VM snapshot method can be requested. The following must be true before the child VM snapshot method is used during a Hyper-V virtual machine backup.
- Hyper-V Integration Services must be installed, enabled, and running on the virtual machine being backed up. Hyper-V integration services are the specialized bundle software/services that allow special interaction between the Hyper-V host and the guest virtual machines.
- To look at a listing of available integration services that are installed, take a look at the Microsoft Technet article here.
- The service we are interested in as regards to backups – Hyper-V Volume Shadow Copy service
- ***Note*** Windows 2000 – the Hyper-V Integration service is not supported
- The Hyper-V virtual machine must be running
- The snapshot file must location has to be the same location as the virtual machine files (VHDs) are located
- The guest operation system must be running on volumes that are configured as basic disks and not dynamic disks
- The guest virtual machine disks must be formatted using a file system that supports snapshots such as NTFS. FAT32 is not supported as an example for an online backup.
Child VM Snapshot backups are preferred because they are:
- Online backups
- Application aware
Backing up VMs Similar to VSS snapshots
For the most part, the process that is used to backup a Hyper-V virtual machine using the child VM snapshot method is similar to a backup using VSS. The unique process to Hyper-V happens when the Hyper-V VSS writer included with the integration services processes the PrepareForSnapshot. In event that the child VM snapshot was used, there is additional processing ran.
When backup software interacts with Hyper-V and requests a backup of a specific virtual machine that is either powered off or doesn’t qualify for the child VM snapshot method the following happens:
- The virtual machine is hibernated
- Hyper-V host VSS provider takes a VSS snapshot of a volume on which the VM disks are located
- After processing the PostSnapshot event, VMs that were backed up using the saved state method are returned to the state they were in before the backup started.
Child VM Snapshot
VMs using the child VM snapshot method have the Hyper-V volume shadow copy requestor service in the child VM processes the backup. The child VM operations happen when the PrepareForSnapshot event happens with the host operating system processing.
The Hyper-V VSS writer then returns from the PrepareForSnapshot event and the host image of the VHD files that had the snapshots taken are rolled back to the snapshot taken during the PrepareForSnapshot processing event. This processing is done independently of the VSS writers in the child VM.
Windows Updates and Hyper-V Integration Services
One thing to note as a Hyper-V administrator is to make sure you keep the integration services updated on guest virtual machines as outdated integration services on guest virtual machines will cause backups to utilize the “saved state” method of performing backups which brings interruptions to virtual machine service.
Understanding there are differences in the way backups are handled in a Hyper-V environment can make the difference in downtime for a particular virtual machine as well as whether or not the backup is a transactionally consistent backup. Looking at Hyper-V backups saved state vs child VM snapshots can yield some interesting finds as we see that saved state are not as desirable, but are the default “all else fails” mechanism. Child VM snapshots method is the preferred method of the two and can create online backups that are application aware.