Udostępnij za pośrednictwem


The Wonder of Volume Shadow Copy and Hyper-V

Microsoft introduced the Volume Shadow Copy Service (VSS) as part of Windows Server 2003. VSS lets you coordinate necessary actions to create a consistent point-in-time copy (also known as a shadow copy or snapshot) of data for backup purposes.  It allows you to create manual or automatic backup snapshots of data and coordinates with properly registered applications and services.  VSS can (for example) be used to take periodic, point in time snapshots of a file server to give remote users the ability to restore old copies of their files. 

To create a snapshot, a VSS requestor (backup utility) requests that an image be created.  The VSS provider (comes with Windows Server) coordinates with application specific VSS writers to coordinate and “freeze” application data for snap shot creation.  Microsoft SQL Server and Exchange have VSS writers, as do many of the service that ship with Windows Server (including Active Directory, DHCP,WMI, and lots of others).  

VSS Process

With Windows Server 2008, Microsoft included a VSS writer for Hyper-V which enables consistent snapshots to be created of VMs running on Hyper-V! 
Microsoft also added a new command line tool for administrators to manage this VSS process called DiskShadow (more on this cool command in a later post).

 

When a VSS aware backup utility requests a backup of a system running Hyper-V, the system coordinates with the a VMs to “quiesce” disk IO.  There are two ways that a VM can be consistently backed up Hyper-V depending on the VMs level of “integration” with the host. 

  1. If a VM is running a VSS capable operating system (Server 2003 or newer), has Integration Services installed, and  has the “Backup” integration service enabled (default), then the request to snapshot will pass into the VM and cascade into a VSS request to “quiesce” apps in the VM.  In this case, a consistent snapshot can be created with NO downtime of the VM!
  2. If a VM is not VSS capable (Windows 2000, Linux, UNIX), does not have Integration Services installed, or the “Backup” checkbox is not selected as part of it’s configuration, Hyper-V will briefly freeze the VM – pause execution and save the contents of VMs memory to disk. Once memory is saved, the snapshot will be created, and execution will resume.

image

Once the snapshot is generated, the consistent image of virtual machines and their configuration can be exposed to the requestor (the backup utility) and restorable data can be copied off for later use.  Keep in mind that all the storage for a VM using a host-base backup must be leveraging VHDs for storage (not pass-through disk or iSCSI), otherwise the host can’t take an image of the VMs.  The files and data that is captured can be used to quickly and easily restore the virtual machines and their configuration.

If you want more details of how VSS works with Hyper-V, check out MSDN.   In my next post, I’ll describe a simple backup process you can use that takes advantage of the diskshadow command line tool.

-John

Comments

  • Anonymous
    November 18, 2009
    Great Job, I can't wait to try it..

  • Anonymous
    November 28, 2011
    Like Windows 2000 and Unix, Windows XP as a vm doesn't have the hyperv shadow copy requestor service either. Otherwise I must do something wrong...