Pages

iDrive

IDrive Remote Backup

Monday, 7 May 2012

How to manually merge Hyper-V snapshots into a single VHD


Okay, so you have to recreate your VM configuration and you absolutely know that your VM had a snapshot at some time. 

You also realize that if you just link to the base VHD that you will lose the current state of your VM - what do you do? 


You manually merge your snapshots into your base VHD before you boot your VM. (I am assuming that you know how to connect to an existing VHD using the new VM wizard). 
Merging of snapshots can be performed manually. This is achieved by: 
  1. On your Hyper-V host.Power off the Virtual Machine. 
  2. Make a copy of the VHD and its corresponding AVHD files. 
  3. Rename the AVHD extension to VHD. 
  4. Write down the order of the disks from youngest to oldest (the oldest should be the root VHD). You can do this by looking at the last modified time stamp on the origional AVHD files, find the one that last changed. And find the last one that changed before it. 
  5. In the Hyper-V manager, open the Edit Disk wizardBrowse to the youngest VHD in the chain, then choose 'reconnect' to point to the next youngest (the one that came before). 
  6. Open the Edit Disk wizard a second time and merge. 
  7. Then repeat the process until you have only a single VHD. 
In a disaster case, you need to recover a copy of the root VHD prior to attaching it to a new VM and booting it (the act of booting it, modifies it) 
Usually the most difficult part of this process is finding the last AVHD (differencing disk) in the chain. 
The easiest way to do this is to find the configuration file for the VM. 



Then open up that configuration file and locate the information for the virtual hard disk. In the screen shot below is the location of the current running state of the VM. The snapshot is a point in time to return to, the current running state is the "Now" and is contained in a differencing disk (AVHD) after a snapshot has been taken. 

Now, find that AVHD file within the file system and rename it to VHD. 
Now, go back tot he Hyper-V manager and open the "Edit Disk" wizard - Select the disk that you renamed above, and merge this disk into the one before it. 

This process can be continued until all of the snapshots are merged back into a single VHD (the base VHD). 


No comments:

Post a Comment