A highly versatile function in Windows Server 2008 R2
Hyper-V is the option to create a snapshot of a guest session. A
snapshot in Windows Hyper-V uses Microsoft Volume Shadow Copy Service
(VSS) technology that captures an image of a file on a server—in this
case, the file is the VHD image of the virtual server itself. At any
point in time in the future, the snapshot can be used for recovery.
Snapshots for Image
Rollback
One common use of a guest image
snapshot is to roll back an image to a previous state. This is
frequently done with guest images used for demonstration purposes, or
test labs where a scenario is tested to see the results and compared
with identical tests of other scenarios, or for the purpose of preparing
for a software upgrade or migration.
In the case of a guest image used
for demonstration purposes, a user might run through a demo of a
software program where they add information, delete information, make
software changes, or otherwise modify information in the software on the
guest image. Rather than having to go back and delete the changes, or
rebuilding the image from scratch to do the demo again, with a snapshot,
the user can simply roll the image back to the snapshot that was
available before the changes were made to the image.
Image rollback has
been successfully used for training purposes where an employee runs
through a process, then rolls back the image so they can run through the
same process all over again repeating the process on the same base
image but without previous installations or configurations.
In network infrastructures, a
snapshot is helpful when an organization applies a patch or update to a
server, or a software upgrade is performed and problems occur; the
administrator can simply roll back the image to the point prior to the
start of the upgrade or migration.
Snapshots for Guest
Session Server Fault Tolerance
Snapshots are commonly used
in business environments for the purpose of fault tolerance or disaster
recovery. A well-timed snapshot right before a system failure can help
an organization roll back their server to the point right before the
server failed or problem occurred. Rather than waiting hours to restore a
server from tape, the activation of a snapshot image is nothing more
than choosing the snapshot and selecting to start the guest image. When
the guest image starts up, it is in the state that the image was at the
time the snapshot was created.
Creating a Snapshot of a
Guest Image
Snapshots are very easy to
create. To create a snapshot, do the following:
1. | From the
Server Manager console or from the Hyper-V Manager MMC snap-in, click to
select the guest session for which you want to create a snapshot.
|
2. | Right-click
the guest session name, and choose Snapshot. A snapshot of the image
will immediately be taken of the guest image and the snapshot will show
up in the Snapshots pane, as shown in Figure 1.
|
Rolling Back a Guest
Image to a Previous Snapshot Image
The term used in Windows
Server 2008 R2 Hyper-V to roll back an image is called “applying” a
snapshot to an existing image. When an image is rolled back, the image
that is currently running has the snapshot information applied to the
image, thus bringing the image back to an earlier configuration state.
To apply a snapshot, do the following:
1. | From the
Server Manager console or from the Hyper-V Manager MMC snap-in, click
the snapshot to which you want to revert the running guest image.
|
2. | Right-click the snapshot image and choose Apply. The
configuration state of the image will immediately be reverted to the
state of the image when the snapshot was taken.
|
Note
By default, the name of the
snapshot image takes on the date and time the image was created. As an
example, if the virtual machine is called “Windows 2008 R2 IIS,” an
image taken on September 2, 2009 at 9:42 p.m. would show up as “Windows
2008 R2 IIS - (9/2/2009 - 9:42:22 PM).” Snapshots can be renamed to
something more meaningful, if desired, such as “Clean Build with All
Patches”.
Reverting a Snapshot
Session
When working with
snapshots, if you snapshot a session, the revert action can be used on
the virtual machine to revert the guest session’s state to the last
created or applied snapshot. All changes since the last creation or
application of a snapshot will be discarded.