Windows Server backups are usually based on the Volume Shadow Copy Services (VSS). Microsoft exposes VSS through a set of COM APIs. Nearly all of the Windows Server backup applications leverage these APIs. The VSS APIs ensure that data is backed up in a way that protects the integrity of the data that is being backed up. VSS is especially useful for backing up database driven applications because VSS allows the application to be backed up without being taken offline. Without VSS, a backup of a running database would most likely fail, because the data would probably be modified while the backup was still in progress. Even if such a backup completed, the resulting backup would most likely be corrupt.
The Volume Shadow Copy Services consist of three primary components. The first of these components is the VSS Requester. The Requester is the mechanism through which the backup application initiates a backup or restore operation.
The second VSS component is the VSS Writer. Writers are included both with Windows Server and with VSS-aware applications. The writer allows the corresponding application or component to be aware of the backup process, and to enter a state that is suitable for backup before the backup actually begins. It is possible to see the VSS Writers that are installed on a Windows Server by opening an elevated Command Prompt window and entering the following command:
VSSAdmin List Writers
As you can see in Figure A, this particular server includes VSS writers for the Task Scheduler, the VSS Metadata Store, the Performance Counters, Hyper-V, and other things. You will notice in the figure that the command also lists the current state of each writer, as well as any writer specific errors that have recently occurred.
You can use the VSSAdmin List Writers command to see the VSS writers that are installed on a system.
The third component is the VSS provider. The provider creates and maintains the shadow copies that are used internally by the backup process. In case you are wondering, shadow copies are a type of snapshot that is taken just prior to a VSS aware backup. The VSSAdmin command can display the providers that exist on a system, and can also display any shadow copies that may exist. To see a list of the VSS Providers, enter this command:
VSSAdmin List Providers
You can see what the command’s output looks like in Figure B.
You can use the VSSAdmin List Providers command to see a list of the VSS Providers that are installed on a system.
If you want to see the shadow copies that exist on a system, you can do so by using the VSSAdmin List Shadows command. Shadow copy management is usually a function of the backup application, but you can manually create and delete shadow copies by using the VSSAdmin Create Shadow and the VSSAdmin Delete Shadow commands. To see the full list of VSSAdmin commands, simply type VSSAdmin.
Now that you know the basic components that make up the Volume Shadow Copy Service, let’s take a look at how a VSS backup works. The process begins when the requester (which is built into the backup application) tells the Volume Shadow Copy Service to prepare for a backup. Upon receiving this notification, VSS queries each of the writers.
Each of the writers generates an XML file detailing the components and datastores that need to be backed up, in order for the corresponding application or service to be protected. The resulting XML files are sent back to the requester, and the requester makes a determination about what will be backed up.
The next step in the process is that VSS instructs each writer to begin preparation for the creation of a shadow copy. The specific actions that occur vary from one writer to the next, but typically this process incolces flushing caches and completing transactions. When a writer completes its shadow copy preparation, the writer informs VSS that it is ready for the shadow copy to be created.
Once VSS has received notification that all of the writers are ready, VSS instructs the writers to freeze application write I/O. With write operations frozen, VSS instructs the provider to create a shadow copy. Because shadow copies are nothing more than snapshots, the creation process only takes a few seconds. Once the shadow copy has been created, VSS thaws the system, which allows writing I/O to resume. With the shadow copies created and application activity back to normal, VSS allows the requester to create the backup.