How to Merge Hyper-V Snapshots: A Stride-By-Pace Guide

Subscribe banner

There are times when y'all need to install Bone updates or security patches on one of your guest virtual machines (VMs). Notwithstanding, the update process can sometimes go wrong, resulting in a organization failure, loss of configuration data, or the uninstallation of certain programs. Microsoft Hyper-Five has provided the opportunity to create Hyper-5 snapshots, which allow you to save the VM state at a item point in time and roll back the system to its previous state if a organization error occurs.

In today's blog post, nosotros will depict how to merge Hyper-5 snapshots using Hyper-5 Director or PowerShell and how they tin can be used. However, to learn how to manage Hyper-V snapshots, you first need to understand the technology behind them.

What Is a Hyper-Five Snapshot?

A Hyper-V snapshot is a point-in-time copy of a VM, which contains all the data required to restore your data. With the use of Hyper-V snapshots, you can revert the VM to a point when the VM state was captured and the snapshot was taken. Hyper-V snapshot engineering science is enabled past default when the Hyper-V role is installed on your computer and your kickoff VM is created. Hyper-V snapshots of a selected VM can be taken in any country (Off, Running, Paused, and Saved) and the operation is typically complete in a few seconds.

Note that Hyper-V snapshots are currently known every bit Hyper-5 checkpoints, but both of these terms are every bit valid.

Types of Hyper-5 Snapshots

Microsoft Hyper-V provides two types of snapshots:

  • Production snapshots utilise backup technology within the invitee OS to create data-consistent snapshots of the VM. For this purpose, Windows Volume Shadow Re-create Service (VSS) or Linux File Organization Freeze are used. Hyper-5 production snapshots can exist used to capture the land of the product environment every bit they improve information consistency of applications and the guest Os. Notation that Hyper-5 production snapshots do not capture the VM retention land, the information about its CPU activity, or hardware configuration.

In the new OS versions (Windows Server 2016 and Windows 10), production checkpoints are the default option for the checkpoint blazon. However, you tin can alter it in Hyper-V Manager or Windows PowerShell.

  • Standard snapshots capture the VM state, including its CPU activity and retentiveness, and hardware configuration at a specific betoken in time. Thus, a standard Hyper-Five snapshot allows for capturing the current state of applications and rolling back the VM to a specific point-in-fourth dimension country or status. They are mostly applicable in development and examination scenarios. Creating Hyper-5 standard snapshots can't be considered a reliable backup strategy equally they might crusade some data inconsistency issues in applications that are not VSS-aware.

How Hyper-V Snapshots Work

As you know, Hyper-V VMs are stored in the virtual disks, which are of the .vhd(ten) file format. At the same fourth dimension, snapshot files created on those Hyper-V VMs are stored in the .avhd(x) file format and they are kept in the same folder as a hard disk image file. Hyper-V snapshots are basically differencing virtual disks and each of them has a parent-child relationship with the respective parent virtual hard disk. You lot can create up to 50 snapshots for each VM. All Hyper-V snapshots are organized in a hierarchical order, thus constituting a checkpoint subtree.

Checkpoint Subtree (How to Merge Hyper-V Snapshots)

However, the problem is that .avhd(ten) files have a tendency to pile up and accept up a lot of disk space, which consequently affects VM functioning. If you want to remove unnecessary .avhd(x) files, you need to delete Hyper-Five snapshots. This option doesn't imply that you lot are actually deleting the snapshots. Instead, y'all but merge Hyper-V snapshots and the information which they incorporate into a parent disk or another virtual deejay. It is non recommended that you delete Hyper-V snapshots directly from the computer. After you merge Hyper-V snapshots, all .avhd(x) files will be deleted from the disk. This way, you can create boosted space on your Hyper-V host.

How to Merge Hyper-V Snapshots

In one of our previous blog posts, we accept covered how to manage Hyper-V snapshots (create, utilize, rename, enable/disable, etc.). Yet, today's blog mail serves as a guide to manually merging Hyper-V snapshots.

In order to merge Hyper-V snapshots, you lot need to use either Hyper-V Manager or PowerShell. Both of these approaches will be described beneath.

Using Hyper-5 Manager

Before nosotros start to draw how to merge Hyper-5 snapshots, we should showtime determine which snapshots will be merged. Hyper-V snapshots should be merged in a specific order: from child to parent. Therefore, it is important to constitute the structure of the checkpoint tree past establishing the order of their creation: from the newest to the oldest ones.

As mentioned above, each snapshot has a parent-child human relationship with some other snapshot that was created before information technology. All of them combined can be represented in the course of a chain. For example, 3 snapshots were created for 1 virtual difficult deejay. The main virtual disk on which the VM is running acts every bit a parent of the first checkpoint, this checkpoint acts as a parent of the second checkpoint, and the second checkpoint acts as a parent of the third checkpoint.

To plant the checkpoint structure, take the following steps:

one. Open Hyper-Five Manager.

2. In the eye pane, select the VM whose snapshots y'all want to be merged.

3. In the Deportment section on the right, click Inspect Disk.

Inspect Disk to Merge Hyper-V Snapshots

4. Select the .avhd(x) file and click OK.

Open a Hyper-V Snapshot to Merge Hyper-V Snapshots

v. Next, you should come across a general overview of the virtual hd properties, including its proper noun, location, and the parent's name. Determine the parent of the selected .avhd(ten) file.

6. Echo steps 3-5 for each .avhd(x) file and identify their order for merging.

The order of merging Hyper-V Snapshots

Afterwards that, yous can start the process of merging Hyper-V snapshots. Notation that your VM must be turned off to avoid any issues during the merging operation.

To merge Hyper-V snapshots, practise the following:

  1. Open Hyper-V Managing director.
  2. Select the required VM.
  3. Click Edit Disk. The Edit Virtual Hard Deejay Sorcerer will open. Click Next.
  4. Click Scan to select the latest .avhdx file. Click Next.

Locate virtual hard disk (How to Merge Hyper-V Snapshots)

v. Select Merge to merge the changes stored in a differencing disk into the parent or another deejay. Click Next.

Selecting the option Merge Hyper-V Snapshots

6. Select To the parent virtual hard disk drive and click End.

Merge Hyper-V Snapshots to the Parent Disk

seven. To fully complete the process of merging Hyper-V snapshots, repeat steps 1-5 for each .avhd(x) file, until all of the changes accept merged into the original parent disk.

8. The final stride is to reboot the VM to prefer the implemented changes.

Using PowerShell

Before you tin can start to merge Hyper-5 snapshots, ensure that your computer has the Merge-VHD cmdlet enabled. If not, the following error volition announced on the screen:

The term 'Merge-VHD' is not recognized equally the name of a cmdlet, function, script file, or operable plan. Bank check the spelling of the proper noun, or if a path was included, verify that the path is correct and try again.

To remove this issue, open PowerShell as an Administrator and run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Direction-PowerShell

If everything is correct, you should see the post-obit:

Enabling Hyper-V Management in PowerShell (How to Merge Hyper-V Snapshots)

Now, you lot are ready to run the Merge-VHD cmdlet. Annotation that this operation is conducted offline.

To merge Hyper-Five snapshots, run this cmdlet:

Merge-VHD Path = '' DestinationPath = ''

In this instance, the data from several child disks, get-go from the newest one, can be merged into the oldest parent disk. On the screen, you will see the following:

How to Merge Hyper-V Snapshots in PowerShell

After the operation is complete, close down the guest VM and reboot the system. Unlike Hyper-V Manager, which requires you to merge each layer of the deejay chain separately, PowerShell allows you to perform such a complex performance with a single command.

Why You Should Use Hyper-V Snapshots

Hyper-5 snapshots allow for saving the state of the VM before applying configuration changes, installing new software, running any Bone updates, upgrading security patches, etc. If you are about to perform an operation that might change your virtual infrastructure or at that place'due south a high risk of it failing, create a Hyper-V snapshot of your VM beforehand. Information technology will serve as a prophylactic net in instance something goes incorrect and you lot demand to revert the system to it previous state.

Withal, you should be enlightened that Hyper-5 snapshots tin can't exist considered as an actual backup and nosotros do not recommend using them in the product environment. Thus, Hyper-V snapshots deliver the best results when used in development and testing environments.

Information Protection with NAKIVO Backup & Replication

As y'all tin run into, Hyper-V snapshots can't be considered a reliable and constructive substitute for existent data backup. Thus, you should consider using a full-featured backup and recovery solution, which includes multiple data protection options and can salve you considerable time, money, and effort spent when compared with traditional infrastructure maintenance. NAKIVO Backup & Replication is the solution to go with because it can provide an integrated functionality compatible with various virtual environments (VMware, Hyper-V, and AWS EC2) for just a fraction of the price.

With NAKIVO Fill-in & Replication, you can perform epitome-based, application-aware, incremental backup and replication, ensuring that all disquisitional data is securely protected and the storage infinite is finer used. If yous desire to ensure an extra level of data protection, create copies of your backups and transport them offsite or to a deject (Azure or AWS). Thus, if something bad happens to your primary site, the most critical data tin exist restored at whatsoever time.

With NAKIVO Backup & Replication, y'all can too create and maintain VM replicas, which tin be rapidly powered on to accept on the workload of the production site during a disaster. More than so, you can create site recovery (SR) workflows, which allow yous to completely transform your disaster recovery (DR) activities. With Site Recovery, you can orchestrate and automate the entire DR process past arranging various actions and weather into an automated algorithm which can exist run in a single click during a DR event. NAKIVO Backup & Replication includes an advanced backup and DR functionality, which tin reliably protect virtual environments of whatsoever size and ensure concern continuity, even during a DR event, in addition to minimizing management overhead by automating VM protection. Request a alive demo by one of our engineers or download Costless Trial to examination NAKIVO Fill-in & Replication in your virtual environs today and see for yourself the multiple benefits that it provides.

Backup Solution for Hyper-V