An Up Close Look at the Volume Shadow Copy Services

An Up Close Look at the Volume Shadow Copy Services
Guest Post by: Brien M. Posey

One of the big problems with backing up database applications is that oftentimes the data is modified before the backup can complete. Needless to say, modifying data while a backup is running can result in a corrupt backup. In an effort to keep this from happening, Microsoft uses the Volume Shadow Copy Services (VSS) to make sure that database applications are backed up in a consistent state.   This article explains how the Volume Shadow Copy Services work.

The VSS Components

vss

There are four main components that make up the Volume Shadow Copies Services.

These components include:

  • the VSS service
  • the VSS requester
  • the VSS writer
  • the VSS provider

These components work together to provide the VSS backup capabilities.

  • The VSS Service component could best be thought of as the centralized operating system service that ties the various VSS components together. The VSS service insures that the VSS requestor, VSS Writer, and VSS Provider are all able to communicate with one another.
  • At a high level, the VSS requestor generally refers to the backup software. The VSS requestor is the component that asks the VSS service to create a shadow copy. The requestor itself is built into the backup software. This is true for Windows Server Backup, System Center Data Protection Manager, and for third party backup applications such as EMC’s AppSync.
  • The third component is the VSS provider. The VSS provider links the VSS Service to the hardware on which the shadow copy will be created. The Windows Server operating system includes a built in VSS provider. This provider exists at the software level and is allows Windows to interact with the server’s storage subsystem. A VSS provider can exist at the hardware level as well. A hardware level provider offloads shadow copy operations to the storage hardware so that the server operating system does not have to carry the workload. However, when a hardware level VSS provider is used, there is usually a driver that is required to make Windows aware of the storage hardware’s capabilities.
  • The fourth component of the Volume Shadow Copy Services is the VSS Writer. The VSS writer’s job is to insure that data is backed up in a consistent manner. It is important to understand that in most cases there are a number of different VSS writers that work together in parallel to insure that various types of data are backed up properly. Server applications such as Exchange Server and SQL Server include their own VSS writers that plug into the operating system’s existing VSS infrastructure and allow the application to be backed up.

Creating a Volume Shadow Copy

The process of creating a volume shadow copy begins when the requestor (which is usually built into backup software) notifies the Volume Shadow Copy Service that a shadow copy needs to be created. When the Volume Shadow Copy Service receives this request, it in turn notifies all of the individual VSS writers of the impending shadow copy.

When the individual writers receive the request, they take steps to place data into a consistent state that is suitable for shadow copy creation. The exact tasks that the writer performs varies from one application to another, but generally writers prepare by flushing caches and completing any database transactions that are currently in progress. If the application makes use of transaction logs, the logs may be committed as a part of the process as well.

After all of the VSS writers have prepared for the shadow copy, the Volume Shadow Copy Service instructs the writers to freeze their corresponding applications. This prevents write operations from occurring for the duration of the shadow copy (which takes less than ten seconds to complete).

When all of the applications have been frozen the Volume Shadow Copy Service instructs the provider to create the shadow copy. When the shadow copy creation is complete, the provider notifies the Volume Shadow Copy Service of the completion. At this point, the Volume Shadow Copy Service once again allows file system I/O and it instructs the writers to resume normal application activity.

The shadow copy creation process revolves largely around the task of coordinating VSS writers so that the various components of the operating system and any applications that are running on the server can be backed up in a reliable and consistent manner. Even though the individual writers do most of the heavy lifting, it is the provider that ultimately creates the shadow copy.

There are actually several different methods that can be used for shadow copy creation. The actual method used varies from one provider to the next. As you may recall, providers can exist as an operating system component, or it can exist at the hardware level. The shadow copy creation process that is used varies depending on the type of provider that is being used. There are three main methods that providers typically use for creating shadow copies.

The first method is known as a complete copy. A complete copy is usually based on mirroring. A mirror set is created between the original volume and the shadow copy volume. When the shadow copy creation process is complete, the mirror is broken so that the shadow copy volume can remain in a pristine state as it existed at the point in time when it was created.

The second method that is sometimes used for shadow copy creation is known as Redirect on Write. Redirect on Write is based on the use of differencing disks. The shadow copy process designates the original volume as read only so that it can be kept in a pristine state as it existed at the point in time when the shadow copy was created. All future write operations are redirected to a differencing disk. This method is also sometimes referred to as snapshotting.

The third method that providers sometimes use for shadow copy creation is known as copy on write. This is block level operation that is designed to preserve storage blocks that would ordinarily be overwritten. When a write operation occurs, any blocks that would be overwritten are copied to the shadow copy volume prior to the write operation.

Conclusion

As you can see, the process of creating a shadow copy is relatively straightforward. You can gain some additional insight into the process by opening a Command Prompt window and entering the following command:

VSSADMIN List Writers

This command displays all of the VSS writers that are present on the system and also shows you each writer’s status.

Hope you found this helpful!

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s