Hyper-V or VHD Backup

27 בדצמבר 2008

2 תגובות

One of the main advantages in virtualization is having the ability to quickly recover
failed systems. By turning a system into a virtual system you are actually turning
it into a file that can be used on any system that has Hyper-V installed on it thus
enabling quick recovery of a failed system.

The main problem is that to be able to backup a VHD file you need to stop the
virtual machine. Now obviously, on mission critical systems you can’t stop a system
every time you want to back it up. To overcome this issues, you can us the Volume
Shadow Service (VSS) mechanism to take a snapshot of the volume that stores
the VHD files and then copy the relevant files to external storage.

Taking a snapshot of a VHD file is possible since Windows 2008 has a built-in Hyper-V
VSS Writer that brings the virtual machine’s hard drive (the VHD file) to a consistent

Once the snapshot is taken, you can manually mount the snapshot and back it up.

To do this, you should use a tool included with Windows 2008 called ‘diskshadow.exe’.
Diskshadow is an interactive interface to VSS. It has a vast list of commands but if we
concentrate on our specific issue you need to issue the following commands:

set context persistent
[You can set it to volatile if you would like to have the snapshot deleted once you exit
the diskshadow.exe application,although you will not be able to expose it]

add volume <driveletter> alias <alias_you_choose>
(for example add volume t: alias VHDBackup)

set verbose on


Once you complete this set of command you have a snapshot stored.You can view
the stored snapshots by executing the following command:

list shadows all

Once you are ready to back the VHD up, expose the snapshot you would like to use by
using the following command:

expose <ShadowID> <Drive:>

Now you can access the data as you would any drive on your system. To hide the snapshot
execute the following command:

unexpose t:

The major advantage of this feature is that you don’t need to stop a virtual machine
to back it up. From my experience the process of taking a snapshot is relatively quick
and it does not tax a system but I would advise that you do it during afterhours.
One more point to consider is disk space,monitor it closely and delete unused snapshots.

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

2 תגובות

  1. Mocephus15 במאי 2009 ב 0:44

    What about restore? If you're restoring to the same host, no problems; but I've heard that you cannot restore a Hyper-V vhd to a different host because of problems with the GUID. The GUID of the host server is written throughout the registry of the virtual servers.

  2. Erik Rozman28 במאי 2009 ב 10:55

    Hmmm…I am not aware with such an issue and from my experience you can restore it to a different server.