Now that I've gotten some of my math fetish out of my system, I plan on blogging for a while on VSS and how to backup a Windows system. Starting with Windows XP, Microsoft has changed the way backup and restore of Windows system are done. We provided a way to create point-in-time shadow copies of a volume, thus eliminating previous problems of changing time windows and open handles. We also provided a generic backup infrastructure that allows a backup application to coordinate with data stores during backup and restore.
There were a number of problems with Windows backup in previous versions. The first is that it was complicated. Every system service had a different set of backup APIs, there was another set of instructions for backing up the registry, and all this work only backed up the bare system; if you had any third-party stores installed, you had to consult with them to determine how to back them up. Backup applications had to consult a 100-page white paper to figure out how to backup the system, as well as white papers from numerous third-party stores. In addition to this, backup windows caused problems. Files were constantly being modifed during the backup window, another application could have an exclusive handle open to a file, and backup often neccesitated bringing a store down for the duration of the backup window.
In Windows XP, Microsoft shipped the VSS infrastructure. This was shipped mainly in three binary files. VSSAPI.DLL contained the backup infrastructure, VSSVC.EXE implemented a service that coordinates shadow-copy creation, and SWPRV.DLL implemented a provider for shadow-copy creation. We'll talk first about the role of VSSVC.EXE and SWPRV.DLL.
In order to solve the problem of exclusive handles and changing backup windows, Microsoft introduced the notion of Volume Shadow Copies. a volume shadow copy is a point-in-time, unchanging image of some live volume on your system. The shadow copy appears as a new volume on your system (and in Windows Server 2003 you can even give it a drive letter), but all the files on this new volume are read only. What's more, nobody should have any handles open on the shadow-copy volume, eliminating that traditional problem of backup applications on Windows. The model for shadow-copy creation involves three actors: a requestor, a coordinator, and a provider. The requestor is the application that requests the shadow copy. The requestor sends the creation request to the coordinator, which is implemented in VSSVC.EXE. The coordinator then picks a provider to create the shadow copy, and returns a path to the new shadow-copy device. By default the Microsoft provider, which is implemented in SWPRV.DLL, is used to create the new shadow copy.
VSSAPI.DLL implements the new backup infrastructure, which was an attempt to simplify the task of backing up a system. Every data store on a system -- including system services as well as complicated third-party stores -- hosts a piece of code called a writer. A writer knows what files need to be backed up for that store, and also can bring those files to a consistent state. A backup application queries all writers on the system, and uses the information returned by those writers to determine which volumes and files need backing up. It then tells all the writers involved to freeze their data and asks the VSS service to create shadow copies for all volumes involved. This shadow copy now contains all of the stores' data in a consistent state, so writers are allowed to continue writing to the original volume. The backup application can then back up the data at it's leisure off of the shadow-copy volume.
This was a very basic overview of how VSS and the backup infrastructure work. In future posts I'll delve more deeply into some details of VSS. For more information you can also look at the following presentations:
http://support.microsoft.com/?kbid=889247
http://support.microsoft.com/default.aspx?kbid=889346
As well as the MSDN documentation at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vss/base/volume_shadow_copy_service_overview.asp