Merge VHDX and AVHDX: Complete Guide to Merge Hyper-V Snapshots Using Hyper-V Manager and PowerShell — Merge AVHDX and VHDX Step by Step
Hyper‑V snapshots create AVHDX differencing disks linked to a parent VHDX. When snapshots are deleted or checkpoints consolidated, these AVHDX files must merge back into the base VHDX. The merge process is critical: it reclaims storage, restores performance, and ensures the VM runs on a clean disk chain.
This guide explains how Hyper‑V merges VHDX and AVHDX files, what triggers the process, and the steps to manage it safely in production.
VHDX and AVHDX: What Each File Does and Why They Must Be Merged
💽 VHDX: The Base Virtual Disk
VHDX (Virtual Hard Disk Extended) is the primary virtual disk format for Hyper‑V Generation 2 VMs (Windows Server 2012+). It holds the guest OS, application data, and all writes outside of active checkpoints. The VHDX is always the parent disk in the chain — every change eventually merges back into it.
- Max size: 64 TB
- Successor to VHD (used in Gen 1), offering better performance, larger limits, and stronger corruption protection.
📂 AVHDX: The Differencing Disk Created by Every Checkpoint
AVHDX (Automatic Virtual Hard Disk Extended) is the differencing disk Hyper‑V generates when a checkpoint is taken. At that moment, writes to the base VHDX are frozen, and all new changes are redirected into the AVHDX.
- Stores only changes since checkpoint creation.
- References its parent (VHDX or another AVHDX) for baseline data.
This creates a chain:
➡️ VM.vhdx (base) → VM_GUID.avhdx (Checkpoint 1) → VM_GUID2.avhdx (Checkpoint 2) → VM_GUID3.avhdx (Current state)
⚠️ Critical rule: AVHDX files must be merged in reverse order (newest child first, back to the base). Skipping or merging out of order corrupts the disk chain.
🆚 AVHD vs AVHDX: Generation 1 vs Generation 2
- AVHD → Legacy differencing disk for Gen 1 hosts (Windows Server 2008/Windows 7).
- AVHDX → Modern format for Gen 2 hosts (Windows Server 2012+).
- AVHD can still be read by Gen 2 for compatibility, but AVHDX is not backward‑compatible with Gen 1.
👉 Always check the file extension before merging. PowerShell cmdlets handle both formats, but the merge procedure is identical.
📊 VHDX / AVHDX Checkpoint Chain Reference
| File Type | Role | Created When | Contains |
|---|---|---|---|
| .vhdx | Base parent disk | VM creation | Full OS + data at baseline |
| .avhdx (first) | Child of VHDX | First checkpoint taken | All writes after first checkpoint |
| .avhdx (second) | Child of first AVHDX | Second checkpoint taken | All writes after second checkpoint |
| .avhdx (nth) | Child of (n‑1) AVHDX | Nth checkpoint taken | All writes after nth checkpoint |
| .vmrs | Runtime state | Checkpoint of running VM | CPU/RAM state at checkpoint time |
| .vmcx | Configuration | Checkpoint creation | VM hardware config at checkpoint time |
🔄 Why You Need to Merge Hyper‑V Snapshots
⚡ Performance Degradation from Long Checkpoint Chains
Every read on a VM with active AVHDX files must traverse the chain back to the base VHDX. A chain of 10 AVHDX files means 11 lookups per read. I/O slows as chains grow. Microsoft allows up to 50 checkpoints, but performance issues appear much earlier — production VMs with >3 checkpoints need immediate merge.
💾 Storage Consumption Growth
AVHDX files start small but expand as data is written. Left unchecked, they can grow to the full size of the parent VHDX. Backup jobs that fail to clean temporary checkpoints leave AVHDX files consuming datastore space until the volume fills — at which point the VM halts.
🛑 Backup Application Failures
Backup tools (Veeam, Commvault, Windows Server Backup) rely on clean checkpoint chains. Orphaned or mismatched AVHDX files cause errors like “inconsistent snapshot chain” or “unable to read differencing disk.” Merging orphaned AVHDX files is required before backups succeed again.
🗑️ Orphaned AVHDX After Checkpoint Deletion
Deleting a checkpoint in Hyper‑V Manager triggers an automatic merge. If that merge fails — due to I/O errors, low disk space, or service interruption — the AVHDX remains on disk even though the checkpoint disappears from the Manager. The VM stops referencing it, but the file lingers, wasting space. Manual merge is required to reclaim storage and restore a clean chain.
🖥️ Method 1: Merge Hyper‑V Snapshots Using Hyper‑V Manager
⚙️ Prerequisites Before Starting the Merge
Before merging any AVHDX files:
- 🔌 VM must be powered off or in Saved state —
Merge-VHDis offline only. - 🔍 Identify the full checkpoint chain with Hyper‑V Manager or PowerShell
Get-VHD. - 📂 Back up all VHDX/AVHDX files to a safe location — a failed merge without backup = unrecoverable chain.
- 💿 Ensure free space — the parent VHDX expands to absorb merged data.
🛠️ Step‑by‑Step: Merge AVHDX into VHDX via Hyper‑V Manager Edit Disk
- 1. Open Hyper‑V Manager → select the target VM in the center pane.
- 2. In the Actions pane, click Edit Disk → the wizard opens.
- 3. Browse to the VM’s disk directory → locate AVHDX files (VMname + GUID suffix).
- 4. Select the latest AVHDX in the chain → click Next.
- 5. On the Action page → choose Merge → click Next.
- 6. On the Merge page → select To the parent virtual hard disk → click Finish.
- Hyper‑V Manager merges the chosen AVHDX into its parent (another AVHDX or the base VHDX).
- 7. 🔁 Repeat Steps 2–6 for each remaining AVHDX, always starting with the newest, until only the base VHDX remains.
- 8. ✅ Power on the VM
⚡ Method 2: Merge VHDX and AVHDX Files Using PowerShell Merge‑VHD
🔧 Prerequisites: Enable the Merge‑VHD Cmdlet
- The cmdlet requires the Hyper‑V PowerShell module.
- If missing, you’ll see: “The term 'Merge‑VHD' is not recognized as the name of a cmdlet.”
Enable it:
- On Windows 10/11:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell- On Windows Server:
Install-WindowsFeature -Name RSAT-Hyper-V-Tools- Verify availability:
Get-Command Merge-VHD🗂️ Step 1: Map the Full AVHDX Chain with Get‑VHD
Identify every file in the checkpoint chain:
Get-VHD -Path "C:\VMs\VMname\Virtual Hard Disks\VMname_GUID.avhdx"- Output shows
VhdType: DifferencingandParentPath. - Follow each
ParentPathuntil you reach the base VHDX (VhdType: DynamicorFixed).
For complex chains, use Microsoft’s helper function:
function Get-VHDChain {
[CmdletBinding()]
param(
[string]$ComputerName = $env:COMPUTERNAME,
[string[]]$Name = '*'
)
$VMs = Get-VM -ComputerName $ComputerName -Name $Name
foreach ($vm in $VMs) {
$VHDs = ($vm).harddrives.path
foreach ($vhd in $VHDs) {
$VHDInfo = $vhd | Get-VHD -ComputerName $ComputerName
$i = 1
while ($VHDInfo.parentpath -or $i -eq 1) {
if ($i -gt 1) { $VHDInfo = $VHDInfo.ParentPath | Get-VHD -ComputerName $ComputerName }
[pscustomobject]@{
Name = $vm.name
Depth = $i
Type = $VHDInfo.VhdType
Path = $VHDInfo.path
}
$i++
}
}
}
}
Get-VHDChain -Name "YourVMName"🔁 Step 2: Merge Each AVHDX into Its Parent — Newest First
⚠️ Always merge newest → parent → base VHDX. Reverse order breaks the chain.
Examples:
- Merge AVHDX into parent AVHDX:
Merge-VHD -Path "C:\VMs\VMname\VMname_GUID_newest.avhdx" -DestinationPath "C:\VMs\VMname\VMname_GUID_parent.avhdx"- Merge last AVHDX into base VHDX:
Merge-VHD -Path "C:\VMs\VMname\VMname_GUID.avhdx" -DestinationPath "C:\VMs\VMname\VMname.vhdx"- Multi‑level merge (Microsoft Learn syntax):
Merge-VHD -Path "C:\test\Child4.vhdx" -DestinationPath "C:\test\Child2.vhdx"✅ Step 3: Update VM Configuration and Power On
After merging:
- Option A: Edit VM settings → Hard Drive → point to the consolidated VHDX.
- Option B (safer after orphaned chains): Create a new VM → “Use existing virtual hard disk” → select merged VHDX.
Finally, power on the VM.
- Successful boot = merge complete.
- Disk errors = incomplete merge → re‑map chain with
Get‑VHDand repeat.
🗑️ Method 3: Delete Snapshots via Hyper‑V Manager (Automatic Merge)
⚙️ How Automatic Merge Works When Deleting Checkpoints
Deleting a checkpoint in Hyper‑V Manager (Right‑click → Delete Checkpoint) triggers an automatic merge of the associated AVHDX into its parent.
- Runs as a background task while the VM stays online.
- VM continues operating, with only minor I/O impact.
- Preferred for production workloads: no manual file handling, no downtime, no chain mapping.
Automatic merge scenarios:
- 🟢 Delete single checkpoint → merges its AVHDX into parent.
- 🌳 Delete Checkpoint Subtree → merges checkpoint + all children.
- 📦 Delete All Checkpoints → merges entire chain back into base VHDX.
⚠️ When Automatic Merge Fails — Signs and Causes
Automatic merge can fail silently due to:
- 💿 Insufficient disk space (VHDX grows during merge).
- 📉 Storage I/O errors during write phase.
- 🔄 Hyper‑V service interruption (host reboot, Windows Update restart).
- 🔒 AVHDX locked by backup software during merge window.
Signs of failure:
- Checkpoint deleted in Manager but AVHDX file still exists on disk.
- Storage usage unchanged after deletion.
- Hyper‑V event logs show merge errors.
👉 In these cases, switch to manual PowerShell merge (Merge‑VHD) to restore the chain.
🛠️ Hyper‑V Snapshot Merge: Troubleshooting Common Failures
❌ Error: “Merge‑VHD : The term 'Merge‑VHD' is not recognized”
Cause: Hyper‑V PowerShell management module not installed.
Fix:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShellOr on Windows Server:
Install-WindowsFeature -Name RSAT-Hyper-V-ToolsReopen PowerShell as Administrator and retry.
🔒 Error: “The virtual disk is currently in use”
Cause: VM is running, or another process holds the AVHDX/VHDX file open. Merge‑VHD is offline only. Fix:
- Shut down the VM completely.
- Check Task Manager + Hyper‑V event logs for locks.
- If backup software is holding the file, cancel active jobs before retrying.
⚠️ Error: “OperationFailed” or “VirtualizationException”
Cause: Corrupted AVHDX, out‑of‑order merge, or parent path mismatch.
Diagnosis:
Get-VHD -Path "C:\VMs\VMname\VMname_GUID.avhdx"- Verify
ParentPathexists. - If parent path is invalid, metadata is corrupted → proceed to data recovery workflow.
📝 Error: “A parameter cannot be found that matches parameter name 'vmname'”
Cause: Passing -VMName to Merge‑VHD (unsupported).
Fix:
Get-VM -Name "VMName" | Get-VMHardDiskDriveUse the returned disk path with:
Merge-VHD -Path "AVHDX_Path" -DestinationPath "Parent_Path"🚫 Error: Chain Appears Complete But VM Will Not Boot
Cause: VM configuration (.vmcx) still references old AVHDX path. Fix:
- Option A: Edit VM settings → Hard Drive → point to merged VHDX.
- Option B (recommended after orphaned chains): Create a new VM → “Use existing virtual hard disk” → select merged VHDX.
If boot fails, re‑map the chain with Get‑VHD and confirm all merges were completed.
📊 Hyper-V Snapshot Merge Error Reference Table
| Error | Cause | Fix |
|---|---|---|
| Merge-VHD not recognized | Module not installed | Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-Management-PowerShell |
| The virtual disk is currently in use | VM running or file locked | Shut down VM; cancel backup jobs; retry |
| OperationFailed / VirtualizationException | Corrupted AVHDX or wrong merge order | Run Get-VHD to verify chain; always merge newest-first |
| VM won't boot after merge | VM config still references AVHDX | Create new VM pointing to merged VHDX |
| Merge scheduled but AVHDX not shrinking | Automatic merge blocked by low disk space | Free disk space; retry deletion in Hyper-V Manager |
| A parameter cannot be found: vmname | Wrong parameter for Merge-VHD | Use -Path and -DestinationPath with full file paths |
🩺 Recovery When AVHDX or VHDX Files Are Corrupted or Missing
⚠️ When Merge Fails Due to Corrupted AVHDX Data
A corrupted AVHDX — caused by storage faults, host power loss, or partial writes during failed backups — cannot be merged with Merge‑VHD. The cmdlet will throw errors referencing the damaged file.
- The data inside that AVHDX represents all VM changes since the preceding checkpoint. Losing it = losing those changes.
- 🚫 Do not rename AVHDX to VHDX manually. N‑Able documentation warns this destroys metadata and eliminates recovery options.
🌐 Cross‑Platform Context: VMware VMFS, VMDK, and Hyper‑V VHDX Recovery
Admins in mixed environments often face both Hyper‑V and VMware recovery scenarios:
- Hyper‑V → VHDX/AVHDX differencing disks.
- VMware → VMFS datastore + VMDK files.
- VMware’s equivalent of AVHDX is a delta VMDK (
VMname‑000001.vmdk). - When VMFS datastores fail or VMDKs corrupt, Windows/Linux tools cannot parse VMFS structures — specialized recovery is required.
🛠️ DiskInternals VMFS Recovery™ for VMware VMDK and VMFS Recovery
DiskInternals VMFS Recovery™ is designed for VMware recovery:
- Recovers data from corrupted/inaccessible VMFS datastores.
- Restores deleted or damaged VMDK files (including delta snapshots).
- Mounts VMDKs without a running ESXi host.
- Reconstructs VMFS volumes with damaged metadata.
- Recovers VMX configuration files.
- Supports remote ESXi connections via IP + credentials.
Workflow:
- 1. Connect to the VMFS volume.
- 2. Run a full scan.
- 3. Locate VMDK files in the recovery browser.
- 4. Preview integrity.
- 5. Extract to a safe destination.
- 6. Optionally convert recovered VMDK → VHDX for Hyper‑V use.
🛡️ Preventing AVHDX Chain Problems: Best Practices
⏳ Keep Checkpoint Chains Short
- Limit to 2–3 active checkpoints maximum.
- Delete checkpoints promptly after the task is complete.
- For dev/test VMs, schedule weekly “Delete All Checkpoints” to collapse chains.
- 📊 Monitor datastore usage — unexpected growth signals accumulating AVHDX files.
👀 Monitor Background Merge Task Completion
- After deleting a checkpoint, watch storage consumption in Hyper‑V Manager.
- Merge runs in the background — usage should decrease as AVHDX merges into VHDX.
- If usage doesn’t drop within expected time (based on AVHDX size + throughput), check Hyper‑V event logs for merge errors.
💾 Back Up Before Any Manual Merge Operation
- Always copy all VHDX + AVHDX files to a safe location before merging.
- A failed merge in the wrong order can leave the chain inconsistent.
- With backups, you can restore the original chain and retry correctly.
FAQ
What is the difference between VHDX and AVHDX?
VHDX is the base virtual hard disk containing all VM data. AVHDX is a differencing disk created when a Hyper-V checkpoint is taken — it stores only the changes made after the checkpoint. To merge them, all AVHDX files must be committed back into the base VHDX.Can I merge AVHDX files while the VM is running?
Not with Merge-VHD — it requires the disks to be offline. The automatic merge triggered by deleting a checkpoint in Hyper-V Manager runs while the VM is running. Manual PowerShell merge requires the VM to be powered off.Do I have to merge AVHDX files in a specific order?
Yes — always start with the newest AVHDX (the one with no child files) and merge toward the base VHDX. Merging out of order breaks the chain and produces an unrecoverable disk.What happens if I rename an AVHDX file to VHDX?
Do not do this. Renaming the extension does not change the file format. An AVHDX mounted as a VHDX will either fail to mount or present corrupted data, and the original merge path is lost. The only safe way to convert AVHDX to VHDX is via Merge-VHD.
