How To Manually Merge Hyper-V Snapshots into a Single VHD?

The need for OS system updates are required by everyone for the installation of updates or security patches on your guest machine. However, due to some wrong installation processes, the system might fail or there may be a high chance of loss of configuration data. Well, don’t worry, In that case, we have a Hyper-V powered by Microsoft which provides us an opportunity to create the Hyper-V -V snapshots, which will allow you to roll back to its previous state. So, to recover your data or to get your virtual machine in the previous state then you need to Merge Hyper V snapshots.

In this technical guide, we will discuss – “What is a Hyper-V file” & “How to manually merge Hyper-V snapshots”. So, to know this, thoroughly read this blog from top to bottom.

What is Snapshot in Hyper-V?

A Hyper-V snapshot is a copy of a virtual machine at a particular instance of time, which stores all data and information of that particular instance. By the use of a Hyper-V snapshot, one can easily roll back to the previous stage of the virtual machine to that particular point when the snapshot was captured.

This Hyper-V technology is enabled by default on your computer. The main advantage of Hyper-V technology is that merging Hyper-V snapshots can be easily and rapidly taken in online and offline modes. 

Note: Hyper-V snapshots are now known as Hyper-V checkpoints.

Method to Merge Hyper V Snapshots

For merging your snapshots in Hyper-V, There are two methods i.e., by using Hyper-V Manager or Power Shell. However, the merging process using the Hyper-V manager is comparatively easy. So we will discuss the manual method of merging using the Hyper-V manager.

Merge Snapshots Using The Hyper-V Manager

Before you are going to start the merging process, you should determine which snapshot will be merged. Hyper-V snapshots follow a specific order of merging i.e., from child to parent. So, initially, you create a structure of the checkpoint tree to establish the order of their creation from the new one to the old one.

As we have discussed above the snapshot has a parent-child relationship with the previously created snapshots. All of them combine to represent one form of a chain.

Okay let us understand by taking an example, let three snapshots be created for a single virtual hard disk, then the main virtual disk act as a parent of the first checkpoint, also this first checkpoint will act as a parent of the second checkpoint and second of the third. This series continues until all the left checkpoints are taken.

For establishing the checkpoint structure. Just follow the steps given below:-

  • Open the Hyper-V manager.
  • Now, select the VM for taking a snapshot.
  • In the Action section, click on the Inspect Disk.
  • Choose the .avhd(x) file then press the OK button. 
  • Now, on the next window, you will see a virtual hard disk window, including some basic information like name, parent’s name, and location. 
  • Determine the parent of the .avhd(x) file.
  • Repeat these steps to identify their order of merging.

Before you start to merge the Hyper V snapshot you must turn off your VM to avoid any issue during the merging process.

Merge Snapshots in Hyper-V following the mentioned steps:

  • Open the Hyper-V Manager.
  • Choose the required VM.
  • Click on the Edit Disk button. This will open your Edit Virtual Disk Wizard.
  • Then, click on the Next button.
  • Hit on the browse option to see the available .avhdx file. Then, Click on the Next button.
  • Now choose the Merge option to merge the changes available on the parent disk.
  • Click on the Next button.
  • Now on the next window select the To the parent virtual hard disk option.
  • Finally, reboot the VM to see the implemented changes.

Note: For the complete merging process, just repeat the above steps for each of the .avhd(x) files. Do this repetition until all the changes merge into your main parent disk.

Using PowerShell to Merge Hyper-V Snapshots

PowerShell provides a streamlined way to merge Hyper-V snapshots (also called checkpoints) without needing to use the Hyper-V Manager GUI. This is especially useful when managing multiple virtual machines.

Step-by-Step Guide to Merging Snapshots with PowerShell

Step 1: List Available Snapshots

Before merging, you need to identify the snapshots (checkpoints) associated with a virtual machine. Run:

Get-VMSnapshot -VMName "YourVMName"

Replace "YourVMName" with the actual name of your virtual machine.

Step 2: Merge a Specific Snapshot

To merge a specific snapshot into the parent disk, use:

Remove-VMSnapshot -VMName "YourVMName" -Name "SnapshotName"

This will remove the snapshot and automatically merge it with the parent disk.

Step 3: Merge All Snapshots for a VM

If you have multiple snapshots, you can merge all of them using:

Get-VMSnapshot -VMName "YourVMName" | Remove-VMSnapshot

This ensures that all existing snapshots for the specified VM are merged into the main virtual disk.

How to Merge Snapshots in Corrupt Hyper-V?

Hyper-V snapshot allows the VM machine, to save its current state and roll back it when data is corrupt or lost. But sometimes due to corruption in Hyper-v files, it is not easy to merge the screenshots. Therefore it is necessary to fix Hyper-V files to save data from corruption. This can be done by using the Hyper-V Recovery Software. Using this tool you can easily recover data from corrupt Hyper-V files with ease. After that without any hassle, you can merge the Hyper-V snapshots.

Final words

So I hope through this technical blog, you learned about – “How to manually merge hyper V snapshots”.  I hope this guide will help you resolve your problem.

Read here: How to Expand Disk Size in Hyper-V?

Leave a Reply

Your email address will not be published. Required fields are marked *