Snapshots can be created in the Hyper-V Manager (by selecting a virtual machine and selecting Snapshot from the Action menu or panel) and in the Virtual Machine Connection window (by clicking on the snapshot button in the toolbar or by opening the Action menu and selecting Snapshot…).
Selecting to create a snapshot from the Virtual Machine Connection window will result in a dialog that allows you to enter a custom name for the snapshot (e.g. "Before applying Patches" or "Just before I do something stupid and ruin the virtual machine"). If you want you can dismiss this dialog and have the snapshot use an auto-generated name. This auto-generated name will consist of the name of the virtual machine followed by the date and time when the snapshot was taken.
If you select to create a snapshot from the Hyper-V Manager the snapshot will be created with an auto-generated name.
Once you have created a snapshot you can view it in the Snapshots pane of the Hyper-V Manager by selecting the virtual machine that the snapshot is associated with. Snapshots are displayed in the Snapshots pane in a hierarchal manner that describes the order in which the snapshots where taken. One snapshot will have a green arrow head on top of it – this indicates that this snapshot was the last one to be taken or applied to the virtual machine. When you select a snapshot there are a couple of options that are provided to you in the Action menu / panel:
|fig. Hyper-V Actions Pane
||fig. Apply, Rename, Delete Snapshot (Subtree)
Selecting this will allow you to open the Virtual Machine Settings dialog with the settings that the virtual machine had when the snapshot was taken. All the settings will be disabled – because a snapshot is essentially read only. The only settings that you can change here are the snapshot name and the notes associated with the snapshot.
Applying a snapshot to a virtual machine basically means copying the complete virtual machine state from the selected snapshot to the active virtual machine. This process means that any unsaved data in the currently active virtual machine will be lost – and you will be asked if you want to create a snapshot of your current active virtual machine before the selected snapshot is applied.
Once the snapshot is applied the virtual machine will either be in a saved state or stopped (depending on if the snapshot was taken of a running or stopped virtual machine). If there are any settings that you need to change before starting the virtual machine you can now select the virtual machine, open the Virtual Machine Settings, and change them.
This is a quick shortcut that allows you to rename a snapshot without having to open the Virtual Machine Settings.
- Delete Snapshot…
Deleting a snapshot means that you can no longer restore the virtual machine to that point in time. It is important to understand that deleting a snapshot will never effect any other snapshots, nor will it affect the current state of the virtual machine. The only thing that will disappear is the selected snapshot.
Sometimes in order to delete a snapshot we will need to merge the differencing disk that we created for the snapshot (this differencing disk is hidden from the user under most circumstances – I will talk more about the actual plumbing involved with snapshots another day). This merging will happen automatically the next time that the virtual machine is not running.
- Delete Snapshot Subtree…
Will delete the selected snapshot and any snapshots that are hierarchically underneath it.
Once you have snapshots associated with a virtual machine you can use the Revert option. This will take a virtual machine back to the last snapshot that was taken or applied (indicated in the Snapshots pane by the green arrow head) and delete any changes that have been made since that snapshot.