Merge differencing disks (AVHD/AVHDX) to boot Hyper-V machine after restoring to files from Hyper-V datasource
Article Number
000133295
Last Modified
Tue Jan 07 14:54:58 GMT 2020
Description
Hyper-V machine won't boot after restoring files from Hyper-V datasource
AVHD/AVHDX files restored from Hyper-V datasource
Merge differencing disks (AVHD/AVHDX) to boot Hyper-V machine after restoring to files from Hyper-V datasource
Environment
SolarWinds Backup
Hyper-V datasource
Solution
Warning: Do not, under any circumstances, change a file's .AVHDX extension to .VHDX manually prior to contacting support
In some circumstances this can cause data loss
The only time this is valid is when attempting to mount the last AVHDX in Hyper-V's differencing chain; but this should be done only on support's recommendation
AVHD/AVHDX files are differential snapshots created by Hyper-V checkpoint service
AVHD refers to Gen 1 Hyper-V host (Windows 7/Server 2008)
AVHDX is Gen 2 Hyper-V host (Windows 8/Server 2012 and later)
AVHD can be used by a Gen 2 host, but AVHDX is not compatible with a Gen 1 host
In Server 2016/2019 and later, the following file extensions may also be found:
.RCT
Stands for Resilient Change Tracking
Similar to VMware's Change Block Tracking technology, this file tracks changes between backups for the VM, to make subsequent backups run more quickly
.MRT
Stands for Modifiable Region Table
Used for change tracking purposes in the event of a host system crash or power loss, to ensure changes are not missed
These files should not be modified or altered in any way
If these files grow too large, contact Microsoft for assistance
Typically these files should shrink after merging all .AVHD/.AVHDX files for a VM
To merge files manually:
Select Hyper-V server in Hyper-V Manager
On left-hand side, select Inspect Disk
Browse to location of restored AVHD/AVHDX files
Select one of the AVHD/AVHDX files > OK
Record parent disk name
Repeat steps 2-5 for each AVHD/AVHDX file, and record their order (from newest to oldest)
Note: do not use timestamps to determine which files to merge, as this could lead to overwriting the incorrect parent file
Select Hyper-V server in Hyper-V Manager
On left-hand side, select Edit Disk
Next > Select newest AVHD/AVHDX file
Next > Select Merge
Next > To the parent virtual hard disk
Finish
Repeat steps 7-12 for each AVHD/AVHDX disk, until only the VHD/VHDX disk is left for the machine
Mount VHD/VHDX in new virtual machine in Hyper-V and boot
To merge files with PowerShell (requires Windows 10/Server 2016 and later):
Open PowerShell and run command to navigate to directory where AVHDX and VHDX files are located:
Note: if files are on different disk than C:, first change to correct disk with disk letter in PowerShell prompt:
<disk letter>:
For example, if data is located on drive D:, command would be:
D:
To change to correct directory:
cd <directory path where files are located>
Run following command on each AVHDX file:
Get-VHD .\<name of AVHDX file>.avhdx
Note name of parent AVHDX file from ParentPath entry in output
Repeat steps 2 and 3 until you have a list of all AVHDX files with their respective parent AVHDX files
Beginning from newest AVHDX file (only AVHDX file with no child file), run following command:
Merge-VHD -Path '<path to AVHDX>' -DestinationPath '<path to parent AVHDX'
Repeat step 5 on each AVHDX, always starting with newest available file
Once all AVHDX files are consolidated, merge last AVHDX with main VHDX file:
Merge-VHD -Path '<path to AVHDX>' -DestinationPath '<path to main VHDX disk'
Note: this method requires that the Merge-VHD and Get-VHDÂ cmdlets be added to your PowerShell; if you do not have it added, you may receive the following error:
Merge-VHD : The term 'Merge-VHD' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
If you receive this error, run this command from an elevated PowerShell prompt to install the Merge-VHD cmdlet: