April 30, 2018
Host-Level vs. Guest-Level Hyper-V Backup
When using Microsoft’s Hyper-V virtualization platform, backing up your virtual machines is of critical importance. To keep your VM data safe, you should be aware of the different methods of Hyper-V VM backup and which ones can best meet your needs. There are two different approaches to Hyper-V VM backup: guest-level and host-level. The guest-level method resembles physical machine backup, working at the VM level with the help of agents installed on each one. Host-level backup offers more advantages, working at the hypervisor level and backing up entire VMs, including their configurations, which makes recovery easier. Both are explored in detail in this blog post, along with the features of NAKIVO Backup & Replication for host-level backup.
Download the free edition of NAKIVO Backup & Replication to explore the variety of Hyper-V backup capabilities that our solution offers.
Guest-Level Hyper-V Backup
Guest-level VM backup is similar to a physical host backup. Special agent-based software is installed on the guest operating system (OS) to perform the backup process. Almost all backup products for Windows use Microsoft’s Volume Shadow Copy Service (VSS – also known as Volume Snapshot Service). VSS is a technology developed for making application-aware backup copies of your data with snapshots. Special components of VSS called VSS writers are used for this process. In Linux, LVM (Logical Volume Manager) snapshots can be used for a similar purpose.
The Role of Agents
An agent is a piece of backup software that is installed on a physical computer or virtual machine to interact with the file system and applications. Agents can be used to create copies of the entire system or individual files or programs. Agents usually run as a system process inside the guest OS; they establish a network connection with a server on which you can manage backups. Backup solutions that use agents are often called legacy backup solutions.
Use Cases for Guest-Level Backup in the Virtual Environment
Guest-level backup can be used for the following reasons:
- If a guest OS is not officially supported by the hypervisor, which means that making an application-consistent backup using a host-level method is not possible.
- If a VM is connected to a shared storage on the guest OS level or has a directly-attached physical disk (including a pass-through disk) that is not supported by host-level backup software. For example, suppose a VM is attached to a SAN (Storage Area Network) LUN (Logical Unit Number) via iSCSI protocol (by using an in-guest iSCSI initiator), and software such as a database server or a file server is using that volume. In this case, Hyper-V’s VSS writer would be unable to perform a completely consistent backup of all disks used by the VM (the volumes inside the VHD virtual disks and the volumes of the directly attached physical disks). This is because in order to make a proper backup, applications and both disk types must be quiesced when the snapshot is taken. Pass-through disks can be converted to VHD virtual disks for the purpose of performing backups at the host level. Note that the VM can be located on shared storage, such as a NAS (Network Attached Storage) device or SAN. These solutions are used to perform host-level backup with clustering.
- Some organizations with small virtualized environments use guest-level VM backup because they want to save costs. However, this approach is not recommended. While in the past this might have made sense, because agent-based legacy solutions were more economical for environments with few VMs, there are now equally (or more) affordable host-level VM backup solutions for small Hyper-V environments.
Disadvantages of Guest-Level Backup
- Agents must be installed on each virtual machine, which is inconvenient and time-consuming.
- The recovery process is more difficult. An empty VM must first be created, then you have to configure the VM’s settings (virtual CPU, memory, disks, network, etc.). Only then can you restore the VM, and you need restore media in order to reboot.
- Consumption of computing resources is much higher, especially when several virtual machines residing on one Hyper-V host are being backed up at once.
- Agent-based backup software requires the use of root or administrative credentials to configure the agents, which can be insecure.
- No VM-level snapshots.
Host-Level Hyper-V Backup
Host-level backup methods are preferred for Hyper-V VM backup. Host-level backup methods work on the hypervisor level rather than the level of the guest virtual machine, and can back up VMs regardless of the operating system running in them. Virtual machines can be backed up completely, including the virtual disk files (indicated by the VHD format in Hyper-V) and configuration files in which the VM settings such as CPU, memory, network etc. are stored. There are two types of host-level backup methods – the Saved State Method and Child VM Snapshot Method.
Saved State Method
The Saved State Method is an offline method that is not application-aware. When using this method, Hyper-V’s Volume Shadow Copy Service assigns the VSS writer to perform the backup process. If the VM is running at the time, the VM is put into a “saved state”. This means that the VM goes offline for a short period of time while the snapshot is taken. Hyper-V’s VSS writer puts the VM into a hibernated state. This ensures that open files can be saved and the state of running applications can be recorded on the virtual hard disk.
How Does the Saved State Method Work?
Broken down in detail, this process consists of the following stages:
- PrepareForSnapshot event. At this point, the backup software initiates the preparation of the VM for backup and the VM’s state is saved using the hibernation mode.
- Taking the snapshot. Hyper-V’s VSS writer, which runs as VMMS.exe (Virtual Machine Management Service) process is used at this step. The snapshot (which is also referred to as a VM checkpoint in the Hyper-V environment) is taken; the backup software creates a backup based on the snapshot. The creation of the snapshot allows the VM’s data to be backed up while avoiding any data modification during the copying process. When this is complete, the PostSnapshot event is triggered.
- PostSnapshot event. The VM is returned to the previous state (i.e. wakes up from hibernation).
Child VM Snapshot Method
The Child VM Snapshot Method is an application-aware method, and is preferred for backing up VMs that are running. This method can be used for high availability production environments. The VM stays online during the backup operation, but the backup created is still transactionally consistent. While the Saved State Method uses Hyper-V VSS outside the child VMs, the Child VM Snapshot Method uses the VSS mechanism within the child VM (the term "child VM" is synonymous with "guest VM") to create backups.
How Does the Child VM Snapshot Method Work?
The event sequence is partially similar to the Saved State Method.
- PrepareForSnapshot event. The Hyper-V VSS Requestor Service in the child VM triggers the PrepareForSnapshot event to initiate backup creation.
- Taking snapshot event. After receiving the request from the VSS Requestor Service, the snapshot is created. Then control is returned from the Hyper-V VSS Requestor Service to the Hyper-V VSS Writer.
- PostSnapshot event. The VSS writer triggers the PostSnapshot event to inform the backup software that the VM snapshot creation is complete. The backup software can then copy the snapshot as part of the VM backup process.
The Role of Hyper-V Integration Services
Hyper-V Integration Services are used for making backups with the Child VM Snapshot Method; they provide a special interaction between the hypervisor and the child VM. These services comprise a collection of drivers and services that can be individually enabled or disabled depending on your needs. The VSS Requestor Service discussed above is a part of the suite of Integration Services, which must be installed on the virtual machine in order to perform host-level backup.
Since Windows Server 2008 R2 and Windows 7, the Integration Services are included with the operating system. If you want to install or update the Integration Services on the VM manually, you can do this by using the Hyper-V Manager and mounting the vmguest.iso virtual disk image on the VM’s virtual drive. To update the Integration Services manually on a Hyper-V host, you can download them from Microsoft’s site and install them through PowerShell. Windows 10 and Windows Server 2016 can update the Integration Services on hosts as well as on guests via the Windows Update service.
Requirements for Using the Child VM Snapshot Method
The following conditions must be met to perform backup with the Child VM Snapshot Method:
- Hyper-V Integration Services, including the Hyper-V VSS Requestor, must be installed in the child VM.
- All volumes inside the VM must be configured as basic disks rather than dynamic ones. The file systems of the disks inside the child VM must support snapshots (for example, the NTFS file system would meet this criterion).
- The VM snapshot files must be located in the same volume as the VHD files.
- The child VM must be running.
If any of above-listed conditions is not met, the Child VM Snapshot Method cannot be used. A Saved State Method would be used in this case as the default method.
Advantages of Host-Level Backup Methods
As shown above, host-level backup methods are preferred for backing up Hyper-V VMs and offer many advantages over the guest-level method. These advantages can be summarized as follows:
- A hypervisor-level backup is easier to manage. No agents are needed. The backup product can manage the entire Hyper-V host and all the VMs residing on this host. You can select the particular VMs that need to be backed up.
- All content of the VM, including virtual disks, snapshots, and VM settings, is captured during the backup process. You need only select the hypervisor along with a storage location for VM recovery; you don’t need to create and manually configure a new VM.
- Ability to perform online application-aware backup of Hyper-V VMs using the Child VM Snapshot Method, which is critically important for production environments. There is no interruption of virtual machine operation and the backup is transactionally consistent.
- Resource economy (processor, memory, and disk space).
Choosing the Right Backup Solution to Protect Your Hyper-V VMs
NAKIVO Backup & Replication uses host-level methods to back up Hyper-V VMs and simplifies the process of configuring backup jobs. NAKIVO Backup & Replication offers native backup for Hyper-V Server 2012 R2 as well as Hyper-V Server 2016 and can perform block-level image-based backups of running virtual machines without downtime. The product also uses several different storage-saving technologies. Hyper-V backups are incremental due to Resilient Change Tracking (RCT), which tracks the blocks of data that were changed since the last backup. The Hyper-V backup data is stored in the repository using full synthetic mode. Swap files are excluded during the Hyper-V backup process, and the data is globally deduplicated to further reduce the size.
Features of NAKIVO Backup & Replication That Improve Hyper-V Backup
- Application-aware backup mode allows you to make consistent backups of VMs that run Microsoft Exchange, SQL Server, Active Directory, and other applications or databases.
- Storing Hyper-V backups remotely in the Azure or AWS cloud provides an additional level of protection against disasters.
- Built-in backup verification checks that the backup is consistent and helps you ensure that the backed-up data stored in the repository is identical to the data of the source VM. With the Screenshot Verification feature, screenshots of loaded operating systems of test-recovered child VM are sent by email immediately after backup is performed, automatically.
- Cluster-friendly features help you back up VMs in Hyper-V Failover clusters. The VMs can change their location between the different hosts within the cluster. The product automatically tracks the VMs’ location, and they can always be backed up.
Today’s blog post has covered guest-level as well as host-level backup methods for Hyper-V virtual machines. Guest-level backup requires the use of agents, while host-level backup offers a number of advantages, including simpler recovery and resource economy. This is why NAKIVO Backup & Replication performs application-aware, host-level Hyper-V backup. The Child VM Snapshot Method is typically preferred for production environments because of the ability to create transactionally consistent online backups without interrupting the virtual machine’s operation. When a VM is offline, the Saved State Method can be used. If neither host-level backup method can be used, whether for compatibility reasons or other restrictions, guest-level backup can be performed.