Volume Shadow Copy Service (VSS)

· 3 min read
Table of Contents

What Is VSS?

Volume Shadow Copy Service (VSS) is a set of Microsoft APIs. It allows users to perform backups or snapshots on files and volumes even when they are in use. VSS provides a consistent interface that allows coordination between user applications that update data on disk (writers) and backup applications (requestors).

How It Works

  1. Gather the writer metadata and prepare for shadow copy creation. Each writer creates an XML description of what is getting backed up. These XMLs are provided to the VSS. The writer also defines a restore method for all components. The VSS provides the writer’s description to the requester, which then selects the components to back up.
  2. The VSS notifies all the writers to prepare their data for making a shadow copy. Each writer prepares the data as appropriate. When finished, the writer notifies the VSS.
  3. The VSS tells the writers to freeze application write I/O requests. Read I/O requests are still possible. The application freeze is not allowed to take longer than 60 seconds. The VSS flushes the file system buffers and then freezes the file system, ensuring that the file system metadata is logged in a consistent order.
  4. The VSS tells the provider to create the shadow copy. This period lasts no more than 10 seconds, during which all write I/O requests to the file system remain frozen.
  5. The VSS releases file system write I/O requests.
  6. VSS tells the writers to thaw application write I/O requests. At this point applications are free to resume writing data to the disk.

NOTE: The shadow copy creation can abort if the writers stay frozen for longer than 60 seconds or if the providers take longer than 10 seconds to commit the shadow copy. The requester can retry the process or notify the administrator to retry at a later time.

Upon creation, the VSS returns location information for the shadow copy to the requester. More detailed information is available in the Microsoft VSS documentation.

SQL Writer Service

When it relates to SQL Server, most of the time any errors on backups are not caused by SQL. But when they are, it is likely that the SQL Writer Service is not enabled. The service installs without user intervention when installing SQL Server and provides added functionality for backup and restore of SQL Server through VSS.

SQL Writer Supports

  • Full database backup and restore including full-text catalogs
  • Differential backup and restore
  • Restore with move
  • Database rename
  • Copy-only backup
  • Auto-recovery of database snapshot

SQL Writer Does NOT Support

  • Log backups
  • File and filegroup backup
  • Page restore

Limitations and Problems

  • Point-in-time recovery – It is possible you will not meet your RPO. Usually you can only recover to the last point of your backup, not a specific time.
  • Transaction log clearing – VSS backups will not clear the SQL log file. This needs to happen through the native SQL commands.
  • Pauses in I/O – During a backup, it is possible that database I/O will pause for just under 70 seconds. This can lead to users complaining about performance issues or disconnections.

Common Troubleshooting

A few things to check when getting errors:

  1. The SQL Writer service needs to be running at the time of the backup
  2. The service needs to be running as the Local System account
  3. The NT Service\SQLWriter login needs to be active inside SQL Server (this account is designated as no login, which limits vulnerability)

Next Steps

If none of these are the cause of your problem, reach out to your backup solution vendor. Include the following in the email:

  • That you checked the three steps listed above
  • The Event Viewer errors or warnings
  • A detailed description of what you are experiencing
  • How often the problem occurs

Comments