How to Merge Hyper-V Snapshot (2 Detailed Ways) and Why

When your VMs are running slow and the storage is running out of memory, merging Hyper-V snapshots is the way you may consider. In this way, you can not only improve VM performance, but also optimize storage utilization.

By @Amelia Last Updated September 3, 2024

What is a Hyper-V Snapshot

A Hyper-V snapshot is a feature in Microsoft Hyper-V virtualization platform that allows you to capture the state of virtual machines (VMs) at a specific point in time. Using Hyper-V snapshots, you can restore a virtual machine to the state it was in when you captured the virtual machine's state and took the snapshot. This article will introduce you the step-by-step guide to merge Hyper-V snapshots in Hyper-V Manager and PowerShell.

Types of Hyper-V Snapshot

Hyper-V snapshots mainly have two types, standard checkpoint and production checkpoint. They have different purpose and working process, following are telling their differences and brief introductions.

  • Standard Checkpoint

Standard checkpoints are designed for production environments where maintaining consistency is crucial. It utilizes the Volume Shadow Copy Service (VSS) within the guest operating system to ensure that application consistent snapshots are created.

  • Production Checkpoint

Production checkpoints capture the entire running state of the VM, including its memory, disk and device states. They focus on ensuring that the data inside the VM is in a consistent and application-aware state.

Why: Merging Hyper-V Snapshots

The Hyper-V snapshots already provide powerful functionality for correcting failed software updates and other issues. But following situations can lead us to merge Hyper-V snapshots.

1. Disk Space Management

When you create a snapshot, Hyper-V will create a different disk (.avhdx file) for each virtual hard disk (vhd or vhdx). This disk can only store changes made after the snapshot was taken. Over time, more changes happened and there is more disk created which can consume substantial disk space.

2. Performance Impact

Each time a snapshot is taken, Hyper-V must read data from multiple disk layers, including the base disk and any associated differencing disks, to present the VM's current state. This layered approach increases read and write latency, resulting in reduced VM performance.

3. Data Integrity and Simplification

Merging snapshots integrates the changes stored in the differencing disks back into the parent virtual hard disk (VHD or VHDX), thereby applying the changes and removing the reliance on the differencing disks. This process streamlines the storage structure and lowers the risk of data corruption.

How to Merge Hyper-V Snapshots (2 Ways)

When you delete the Hyper-V checkpoint, the snapshots are automatically merged into the parent disk. To store Hyper-V snapshot file and free up storage space, here we will introduce two ways to merge snapshots manually by using Hyper-V Manager and PowerShell.

Tip: If you cannot delete Hyper-V checkpoints, you can try some regular troubleshooting means first.

Way 1.  Using Hyper-V Manager

When you delete checkpoints in Hyper-V Manager, the merging process consolidates the changes from the checkpoint into the parent virtual hard disk (VHD). Here's a detailed look at how to merge Hyper-V snapshot step by step:

Step 1: Launch the Hyper-V Manager on the host machine and select the VM that you want to merge.

Step 2: Click Inspect Disk in Action tab.

Step 3: Select a .avhdx file and open it, you can get the name of its parent disk.

Step 4: Repeat step 1 to 3 to get the correct order of VM snapshots.

Step 5: Then we begin to merge snapshots. Open Hyper-V Manager to select the VM and then click Edit Disk in Action tab.

Step 6: When you see the Edit Virtual Hard Disk Wizard, click Next.

Step 7: Click Browse and select the latest .avhdx file, click Open and then click Next.

Step 8: Select Merge and click Next.

Step 9: Then select To the parent virtual hard disk and click Next.

Step 10: Repeat step 4 to 9 until all the snapshots are merged into the parent disk (.vhdx file).

Step 11: After all these steps, you can export Hyper-V VM to store the entire VM.

Way 2. Using PowerShell

Before merging Hyper-V snapshots with PowerShell, you must ensure that your computer has the Merge-VHD cmdlet enabled. If not, you can open PowerShell as an Administrator and run the command:

After all these done, you could see this:

Now you could run this cmdlet to merge Hyper-V snapshots:

Now, the child disks can merge into the oldest parent disk.

After all these are complete, shut down the guest VM and reboot the system.

Easily Make Hyper-V VM Backup with a Free Tool

It’s better to backup your VMs before merging Hyper-V Checkpoints. Due to checkpoints have unstable performance, backup before merging can offer you a security environment. This will not lead to data loss, so you can have checkpoints in ease mind. Backup tools is an efficient way can offer you to secure Hyper-V VMs.

AOMEI Cyber Backup offers automated Hyper-V backup solutions and cloud storage to further enhance the reliability and accessibility of backup data. It can provide you many advantages making it to meet different backup environments:

Easy-to-use: It’s a user-friendly software with intuitive interface. Automated Backup: Configure a backup schedule, and backup tasks will automatically execute at the designated time. Agentless Backup: Create full, standalone image-level backups for entire VMware virtual machines without installing agents on each VM. Cloud Archive: You can add a cloud storage for example the Amazon S3 bucket and then to backup data to Amazon S3 storage.

You can click the following button to download the freeware-AOMEI Cyber Backup.

Download FreewareVMware ESXi & Hyper-V
Secure Download

Three simple steps to backup Hyper-V VMs:

1. Bind Device: Navigate to Source Device and click Hyper-V > + Add Hyper-V to add a host. Then entering the Device Information and User Information and click Confirm.

2. Create Backup Task: Navigate to Backup Task > + Create New Task and then setup Task Name, Target, Archive, and Schedule.

Target: You can select to backup to a local path, or to a network path.

Archive: Click Backup Task > Backup Archive > Add New Archive, and then click Start to begin archiving.

Schedule: You can choose to perform full and incremental backup, and automate execution daily, weekly or monthly according to the frequency you specified.

3. Start Backup: Click Start Backup and select Add the schedule and start backup now, or Add the schedule only.

Conclusion

Merging Hyper-V snapshot is an essential process for maintaining the performance and integrity of virtual machines. Properly managing and merging snapshots ensures that your Hyper-V environment remains efficient and reliable, helping to prevent potential performance issues caused by the accumulation of multiple snapshots.