Performing snapshots on
virtual machines is not recommended in production environments.
Snapshots are commonly used in test and development environments,
however, so it’s important to be able to manage them properly. Hyper-V
allows you to perform the following kinds of actions concerning
virtual machine snapshots:
-
Performing snapshots You can
perform snapshots on a virtual machine to create point-in-time
images of the virtual machine that you can return to later if
needed. Snapshots can be performed on both running and stopped
virtual machines and with any guest operating system installed.
There is no interruption to running virtual machines when
snapshots are performed on them.
-
Applying snapshots This
action copies the virtual machine state from the selected snapshot
to the virtual machine. As a result, any unsaved data in the
virtual machine will be lost. If the snapshot was originally
performed when the virtual machine was running, the virtual
machine will be in a saved state after the snapshot has been
applied. If the snapshot was originally performed when the virtual
machine was stopped, the virtual machine will be in a stopped
state after the snapshot has been applied.
-
Reverting virtual machines
This action takes the virtual machine back to the last snapshot
that was taken or applied, which is indicated in the Snapshots
pane of Hyper-V Manager by a green arrow head with the word “Now”
beside it as shown in Figure 4. The action
will also delete any changes that have been made to the virtual
machine since that snapshot was performed.
-
Deleting snapshots This
action deletes the files associated with the snapshot. As a
result, you will no longer be able to restore the virtual machine
to the point in time represented by the deleted snapshot.
-
Deleting a snapshot tree This
action deletes the selected snapshots and also any snapshots
underneath it in the hierarchy of snapshots of the virtual
machine.
-
Exporting snapshots This
action exports the selected snapshot as a separate and independent
virtual machine, which can then be imported onto another Hyper-V
host if desired.
Note
Renaming
snapshots
You can also rename snapshots, and this is generally a good
idea. Give each snapshot you perform a name that describes either
the purposes of the snapshot or state of the virtual machine just
before the snapshot was performed.
You can use Hyper-V Manager to perform, apply, delete, revert,
or export snapshots of virtual machines. To perform a snapshot or
revert a virtual machine, right-click on the appropriate virtual
machine in the Virtual Machines pane of Hyper-V Manager as shown in
Figure 5. To
apply, export, rename, or delete a snapshot or snapshot tree,
right-click on the appropriate snapshot in the Snapshot pane as
shown in Figure 4
earlier.
You can also use Windows PowerShell to perform, apply, rename,
export, or delete snapshots and to revert virtual machines. For
example, you can use the Checkpoint-VM cmdlet to perform a snapshot
on a virtual machine, the Get-VMSnapshot cmdlet to display a list of
snapshots of a virtual machine, the RemoveVMSnapshot cmdlet to
delete a snapshot or snapshot tree, and so on. For example, here is
some output from running Get-VMSnapshot for a virtual machine on
which a critical software update is being tested:
PS C:\> Get-VMSnapshot -VMName SRV-B -ComputerName HOST4
VMName Name SnapshotType CreationTime ParentSnapshotName
------ ---- ------------ ------------ ------------------
SRV-B Before installing update ... Standard 8/13/2012 8:48:15 PM
SRV-B After reconfiguring firew... Standard 8/13/2012 9:18:57 PM Before installi...