Tuesday, 22 October 2013

Hyper -V snapshot merge process

In Microsoft Hyper-V, snapshots are merged with disks when the machine is shut down. This means that if a snapshot has been taken and deleted, it will not be merged until the virtual machine is off for a long enough period of time to merge the files. In Hyper-V Manager, progress is not shown. To view progress of the snapshot merge, a PowerShell Command must be run.
When this is displayed in Hyper-V Manager:

Run the following in PowerShell on the Hyper-V host to view snapshot merge progress:
get-wmiobject -namespace “root\virtualization” -Query “select * from Msvm_ConcreteJob” | Where {$_.ElementName -eq ‘Merge in Progress’}

See JobStatus and PercentComplete rows
Details: Example shows standard Hyper-V Manager GUI and Powershell commands
A Virtual Machine Snapshot is present

Notice the file structure at the VM location. Note, the AVHD and VHD may be in varying directories.

The snapshot is then deleted
And the VM shut down
Hyper-V Manager will give the option to “Cancel Merge in Progress”
Note, you can still start up the virtual machine at any time.  This will cancel the merge operation and the VM will function. However, all merge progress will be purged and will start again at the next VM shut down.  For snapshot files to merge successfully, you need to ensure that the virtual machine is off until the merge operation is complete.
To view the progress of the snapshot merge, run PowerShell as admin on the Hyper-V host system.
Note, this WMI query can be run remotely if you specify the target and have necessary network protocols open.  This example shows the PS being run from the local host
get-wmiobject -namespace “root\virtualization” -Query “select * from Msvm_ConcreteJob” | Where {$_.ElementName -eq ‘Merge in Progress’}

Run the same command and view PercentComplete until the field reaches 100.  Job Status shows “Job is Completed”
Hyper-V Manager no longer gives the option to “Cancel Merge in Progress”
And the file structure only shows a single VHD file.  The AVHD snapshot file has been merged.
The VM can now be started and will run on the single, merged vhd file

1 comment:

  1. There is noticeably much to experience this. I believe you made several well points in Features as well. http://www.lowhosting.com/justhost-review/

    ReplyDelete