Share via

Recover the VM from vhdx and avhdx in Hyper-V

Anonymous
Mar 25, 2024, 12:47 PM

I have a Windows Server 2016 Hyper-V server; and the VM has been deleted in hyper-v manager but I still have the VHDX and AVHDX files.

I am trying to merge them and setup a VM using the VHDX in Hyper-V, but unfortunately, it gives me an error every time. How can I fix this issue?

PS C:\export\prod-vm2\Virtual Hard Disks> dir

Directory: C:\export\prod-vm2\Virtual Hard Disks 

Mode LastWriteTime Length Name


-a---- 24/02/2024 11:06 PM 117981577216 prod-vm2.vhdx

-a---- 15/03/2024 9:00 AM 65768783872 prod-vm2_8963AB8D-B980-494B-9981-098D02643149.avhdx

PS C:\export\prod-vm2\Virtual Hard Disks> Merge-VHD -Path .\prod-vm2_8963AB8D-B980-494B-9981-098D02643149.avhdx -DestinationPath .\prod-vm2.vhdx

Merge-VHD : Merging virtual disk 'c:\export\prod-vm2\virtual hard disks\prod-vm2_8963ab8d-b980-494b-9981-098d02643149.avhdx' to 'c:\export\prod-vm2\virtual hard disks\prod-vm2.vhdx' failed.

At line:1 char:1

  • Merge-VHD -Path .\prod-vm2_8963AB8D-B980-494B-9981-098D02643149.avhd ...
  • 
        + CategoryInfo          : NotSpecified: (:) [Merge-VHD], VirtualizationException 
    
        + FullyQualifiedErrorId : OperationFailed,Microsoft.Vhd.PowerShell.Cmdlets.MergeVhd 
    
    

PS C:\export\prod-vm2\Virtual Hard Disks>

PS C:\export\prod-vm2\Virtual Hard Disks>

PS C:\export\prod-vm2\Virtual Hard Disks> get-vhd .\prod-vm2_8963AB8D-B980-494B-9981-098D02643149.avhdx

ComputerName : AEXAC-HV1

Path : c:\export\prod-vm2\virtual hard disks\prod-vm2_8963ab8d-b980-494b-9981-098d02643149.avhdx

VhdFormat : VHDX

VhdType : Differencing

FileSize : 65768783872

Size : 129922760704

MinimumSize : 129920680448

LogicalSectorSize : 512

PhysicalSectorSize : 4096

BlockSize : 2097152

ParentPath : C:\export\prod-vm2\Virtual Hard Disks\prod-vm2.vhdx

DiskIdentifier : 125F2F18-94E6-4DDB-9397-7F7F2F5290F5

FragmentationPercentage :

Alignment : 1

Attached : False

DiskNumber :

Number :

Windows Server High availability Virtualization and Hyper-V

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} vote

6 answers

Sort by: Most helpful
  1. Anonymous
    Mar 28, 2024, 2:42 AM

    Hi Admin,

    Please try using the following steps to merge:

    1. There is one checkpoint:

    1. Click "Edit Disk":

    1. Choose the .avhdx file to merge.

    1. Merge it into parent .vhdx file.

    Best Regards

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    Mar 29, 2024, 6:42 AM

    The VM has been deleted from Hyper-V Manager. Can I add both disks (VHDX & AVHDX) and set up the VM again in Hyper-V Manager?
    How do I add the AVHDX file and set up the VM? Thanks,

    0 comments No comments
  3. Anonymous
    Mar 29, 2024, 6:58 AM

    I created a new VM with a VHDX, then attempted to change the AVHDX file and encountered the error message shown in the snapshot.

    What can I do as the next step?

    Image

    0 comments No comments
  4. Anonymous
    Apr 9, 2024, 12:35 PM

    Can anyone help with this issue?

    0 comments No comments
  5. Anonymous
    Jun 24, 2024, 5:04 AM

    VHDx & AVHD are in a chain like a UniDirectional linked list.

    Propperties via aVHDx cant be changed & when you cant alter VHDx while aVHDx are in place.

    First merge them all together then alter.

    ***Always keep a backup.

    0 comments No comments