Creating and Managing Hyper-V Snapshots

From Virtuatopia
Jump to: navigation, search
PreviousTable of ContentsNext
The Hyper-V Virtual Machine Connection ToolMigrating Hyper-V Virtual Machines Using Import/Export


Purchase and download the full PDF and ePub versions of this Hyper-V eBook for only $8.99  


In this chapter of Hyper-V Essentials, the creation and management of virtual machine snapshots will be covered.




What is a Hyper-V Virtual Machine Snapshot?

Hyper-V virtual machine snapshots allow the status of a virtual machine (and the corresponding guest operating system) at a particular time to be saved such that it can be reverted to that state at any point in the future. Hyper-V snapshots contain both the configuration settings of the virtual machine, and the state of the guest operating system at the point the snapshot is taken. Snapshots may be taken of virtual machines when they are running, stopped or saved. It is not possible, however, to take a snapshot of a paused Hyper-V virtual machine.

When a snapshot is taken of a saved or running virtual machine, the snapshot contains the status of both the file system and the memory used by the guest operating system. As such, when the virtual machine is reverted to the snapshot everything, including applications running at the time the snapshot was taken, will be restored to the snapshot status.

Virtual machines are reverted to a snapshot status by applying the desired snapshot to the virtual machine.


Taking Hyper-V Virtual Machine Snapshots

Snapshots may be taken of a virtual machine using a number of different approaches using either the Hyper-V Manager or the Virtual Machine Connection tool.

From the Virtual Machine Connection tool window click on the Action->Snapshot.. menu option, or click on the snapshot button located in the toolbar. Alternatively, launch the Hyper-V Manager (Start->Administrative Tools->Hyper-V Manager). Once launched, right click on the virtual machine for which the snapshot is to be taken and select Snapshot from the popup menu. Snapshots may also be triggered by selecting the desired virtual machine from the Hyper-V Manager list and clicking on the Snapshot link in the Actions panel.

When a snapshot is taken from the Virtual Machine Connection tool, a dialog will appear while the snapshot is in progress providing the option to give the snapshot a name other than the default name. If no snapshot name is given, or any of the other methods of taking a snapshot are used, the default name of the snapshot will be constructed using the name of the virtual machine combined with the date and time that the snapshot was taken.

Whilst the snapshot is being taken, the Operations entry for the virtual machine will in the Hyper-V Manager will display Taking snapshot together with a percentage value indicating the progress of the snapshot process.

Hyper-V Manager Snapshot Trees

Snapshots taken of virtual machines are presented in Hyper-V Manager in the form of a snapshot tree, with one tree for each virtual machine. Each new snapshot taken of a virtual machine is added to a new level of the tree for that machine. The snapshot tree for a virtual machine appears in the Hyper-V Manager Snapshot panel when the virtual machine is selected from the list. A typical Hyper-V Manager snapshot tree is illustrated in the following figure:


A Hyper-V Manager virtual machine snapshot tree


If the selected virtual machine is currently running, as is the case in the above illustration, an additional tree entry in the form a green arrow and the word Now represents the currently running virtual machine. Right clicking on this tree item provides options to connect to, or access the settings of the virtual machine.

As each snapshot in a tree is selected, the panel beneath the tree panel will update to display additional information about the snapshot together with a thumbnail screenshot of the virtual machine's console at the point the snapshot was initiated. The following figure shows a typical detail panel for a snapshot:


The Hyper-V Manager snapshot details panel

Managing and Applying Virtual Machine Snapshots

Once a virtual machine snapshot has been selected from the snapshot tree within the Hyper-V Manager tool, a number of tasks may be performed on that snapshot. These actions are listed both in the lower section of the Actions panel, or from a menu when right clicking on the snapshot:

Action

Description

Apply Applies the snapshot to the virtual machine from which it was taken. The virtual machine will revert to the exact state it was in when the snapshot was taken. Any changes made to the virtual machine since the snapshot was taken will be lost. Hyper-V will provide the option to take a new snapshot of the virtual machine's current state before applying the old snapshot.
Rename Allows the name assigned to the snapshot to be changed.
Delete Snapshot Deletes the snapshot and all associated files from the system. This action is irreversible.
Delete Snapshot Subtree Deletes the currently selected snapshot and all other snaphots which are located beneath it in the tree.
Settings Allows the settings of the virtual machine at the time of the snapshot to be viewed. Modification of settings is disabled.

The Anatomy of a Hyper-V Snapshot

When a snapshot is taken of a Hyper-V virtual machine, a number of files are generated. These files are stored, by default, in %SystemRoot%\ProgramData\Microsoft\Windows\Hyper-V\Snapshots. The ProgramData folder is typically a hidden folder and as such will not be visible in Windows Explorer. To view the folder and its contents, therefore, select Tools->Folder Options..., select the View tab and enable the option to Show hidden files and folders. The default snapshot file location may be changed on a per virtual machine basis by selecting the virtual machine in the Hyper-V Manager list, clicking on the Settings... link in the Actions panel and modifying the Snapshot File Location value in the Management settings section.

Each snapshot consists of the following files:

  • Configuration file - An XML file containing the current configuration settings of the virtual machine.
  • Saved state file - A .vsv file containing virtual machine state information.
  • Differencing disk image file - A .avhd differencing disk.
  • Memory image file - A .bin file containing an image of the virtual machine's memory at the point the snapshot was taken.


Purchase and download the full PDF and ePub versions of this Hyper-V eBook for only $8.99