Thursday, 20 September 2012

Better alternatives to manually merging snapshots in Windows Server 2008 R2


There might be times on Windows Server 2008 R2 Hyper-V host when the snapshots will not merge, the virtual machine disappears from the Hyper-V management console or the virtual machine goes into a Critical-Saved or Paused state for what seems to be no reason at all. This blog will discuss the ways in Windows Server 2008 R2 to resolve some common issues with Hyper-V virtual machines and snapshots and avoid having to manually merge snapshots.

Common Scenarios

The virtual machine has unexpectedly disappeared from the Hyper-V Management console. 
This problem can be caused by antivirus software that is installed in the parent partition if the real-time scanning component is configured to monitor the Hyper-V virtual machine files.Antivirus exclusions should be configured per KB; Virtual machines are missing in the Hyper-V Manager Console or when you create or start a virtual machine, you receive one of the following error codes: "0x800704C8", "0x80070037" or "0x800703E3"http://support.microsoft.com/default.aspx?scid=kb;EN-US;961804 
If the virtual machine does not show up in the Hyper-V Manager console once you configure the antivirus exclusions, create a new virtual machine and attach the latest snapshot file. This is where the Inspect Disk wizard comes in handy in order to find the last AVHD in the chain. 
Perform the following steps to create a new virtual machine and attach the latest snapshot (.AVHD) file: 
  1. Open Hyper-V Manager console
  2. In the Actions pane click New Virtual Machine
  3. Give the VM a new name, click Next
  4. Assign Memory, click Next
  5. Assign a Network, click Next
  6. Select Attach a disk later, click Next

The new virtual machine shows up in the Hyper-V console. Now you need to point the virtual machine to use the most recent snapshot in order not to lose the most recent changes to the virtual machine. 
1.   In the Actions pane on the right select Inspect Disk
2.   Browse to the location of the AVHDs you want to Inspect, click Open and you will be presented with the following  window. You can see there is only 1 snapshot and the parent is the VHD. 
clip_image002 
3.   Continue clicking the Inspect button on each AVHD until you have inspected all the AVHDs
4.   Go to the Hyper-V console, right click the virtual machine and go to Settings, change the VHD to point to the most recent AVHD, click OK 
clip_image003 

Note: If you’re performing these steps on a Windows Server 2008 system, the Hyper-V Manager console doesn’t support attaching .AVHD files. To resolve this issue on a Windows Server 2008 system, you need to manually merge the snapshots files and attach the VHD which contains the merged data.

5.   Start the virtual machine
The virtual machine will not start or the status in Hyper-V Management console shows the VM in a Paused state. 
This issue is generally caused when the volume where the VM is stored is low on disk space. The idea way to resolve the issue is to add a new disk to the Hyper-V host that is large enough to hold all the virtual machines VHDS and associated snapshots and Export the VMs to the new disk. Once the virtual machines have been exported you can Import the virtual machine to add them back into the Hyper-V Manager console and the virtual machines will reside on the new disk you added. 
1.   Select the virtual machine in the Hyper-V Manager Console then click Export in the Actions Menu
2.   Click Browse and select a disks with enough free space then click Export
The export process can take a few minutes to a couple of hours+ depending on the size of the VHD and number of AVHDs associated with the virtual machine
Once the Export is finished you can delete the virtual machine from the console then Import the virtual machine to add it back to the console. 
1.   In Hyper-V Manager console got the Actions menu and click Import Virtual Machine
2.   Now browse to the location where the virtual machine was exported
3.   Since the virtual machine was deleted leave it at the default of Move or restore the virtual machine (use the existing unique ID)

clip_image004


The OS was reinstalled on the parent and the virtual machines do not show up in the Hyper-V Management Console. 
The best way to resolve this issue is to create a new VM and attach the most recent AVHD file.
Steven Graves 

No comments:

Post a Comment