How To Fix Broken or Corrupted Hyper-V Disk chain And merge snapshot

 

Sometime Hyper-v can create snapshot or Differencing disks causing the VM not to start :

This can happen because of hardware problem like storage LUN going full and pause, third party backup software trying to backup a full VM while failing over and over causing detached out of sync snapshots and broken disk chains, The Disk folder may look like this :

and the hyper-v show no Snapshots :

To try and fix this first you need to make sure you have a valid backup !!! failing to do so may cause data lost, Please be advised

Now I would recommend to use the Merge-VMDisks.ps1 and you can download it from here at Microsoft Gallery Script Center

This script is function script which mean you first need to upload it to the memory as administrator then you can use the function, To upload it first run as admin (With the dot)

ps c:\. D:\Folder_Name\Merge-VMDisks.ps1

Then make sure you access the function :

ps c:\Get-Item -Path function:

You should get the function in the list

Now you can run them from the session, To found the right disk chain you can go to the setting of the VM get the name of the last know disk configured there . Then you can run :

PS C:\Get-ParentPath Full_Path_and_name_of the configured_Disk

You will get the right list of the disk chain, then before merging the disks you can reconnect it according to the order in the list with “inspect disk” tool from the hyper-v manager :

Rebuild the chain according to the list marking the ignore ID mismatch sometime !

After that try to power-on the VM , if all is well you should be up and running with healthy disk chain .

Then you can safely proceed to merge to disks :

PS C:\Merge-VMDisks -VMName 'VM_Name'

This will merge all the disk on the VM according to the right disk chain .

 


Good Luck

Leave a Reply

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