Using live virtual disk merge in Windows Server 2012 R2 Hyper-V

Live virtual disk merge, a new feature in Windows Server 2012 R2, allows snapshots to be restored without downtime. Expert Brien Posey explains how.

How does the live virtual disk merge option work in Windows Server 2012 R2 Hyper-V?

Brien PoseyBrien Posey

One of the most useful features in Microsoft’s Windows Server (WS) 2012 R2 Hyper-V is the ability to create snapshots, which have been renamed checkpoints in WS 2012 R2. Snapshots allow you to roll an entire virtual machine (VM) back to an earlier point in time without having to do a traditional restoration or a backup. One big change Microsoft will be implementing in WS 2012 R2 Hyper-V is a feature called live virtual disk merge. To understand the benefit of this feature, you have to know a little bit about the way Hyper-V snapshots work.

When you create a snapshot in Hyper-V, you are not actually creating a backup copy of your data. Instead, Hyper-V is creating a differencing disk and establishing a parent-child relationship between the differencing disk and the parent virtual hard disk (VHD). When this happens, the original VHD becomes read-only, and all write operations are directed to the new differencing disk. This allows the original VHD to remain in a pristine state. If a snapshot needs to be restored, the differencing disk is simply removed, and all read/write operations are redirected to the original VHD.

Obviously, Hyper-V does not limit you to creating only a single snapshot. Within reason, snapshots can be created on an as-needed basis. Each time a new snapshot is created, a new differencing disk is also created. Each differencing disk has a hierarchical relationship to the differencing disk that was created before it.

Creating multiple snapshots gives the administrator the option of rolling the VM back to one of many different points in time. The problem is that the accumulation of snapshots can dramatically impact the read performance of the VM.

When data needs to be read, Hyper-V is smart enough to know that the most recently created differencing disk contains the most recent data. As such, it will check the most recent differencing disk first. If the requested data is not found on that differencing disk, Hyper-V will then backtrack through the hierarchy, checking one differencing disk at a time until it finds the data it needs. As such, the impact on the read performance is directly proportional to the number of differencing disks.

The key to restoring a VM's performance is to get rid of unnecessary differencing disks. Hyper-V has always had an option that you could use to delete an unwanted snapshot. Deleting a snapshot does not actually remove it; it simply merges the snapshot data with either the parent VHD or with another differencing disk (depending upon the location of the differencing disk in the hierarchy).

However, differencing disks can only be merged when the VM is off-line. If a company wants to clean up its Hyper-V snapshots, it will have to reboot the VM to complete the process. Windows Server 2012 R2 Hyper-V addresses this problem through a new feature called live merge. As the name implies, live merge will allow differencing disks to be merged together while the VM remains online. This will give organizations with mission-critical VMs a new way to restore performance without having to take the VM offline.

Dig Deeper on Storage for virtual environments