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. The VSS provides a consistent interface that allows coordination between user applications. Even if they update data on disk (writers) or back up applications (requestors).
How it works
- 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. It then selects the components that is getting backed up.
- 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.
- The VSS tells the writers to freeze application write I/O requests. Read I/O requests are still possible. This allows it to create the shadow copy of the volume or volumes. 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. This ensures that the file system metadata logged and is in a consistent order.
- 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.
- The VSS releases file system write I/O requests.
- VSS tells the writers to thaw application write I/O requests. At this point applications are free to resume writing data to the disk.
- 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 (go back to step 1) 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 here.
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 usually not enabled. The service installs without user intervention when installing SQL Server.
This service 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
- Point-in-time recovery – It is possible you will not meet your RPO for your business. As 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 Naive SQL commands.
- Pauses in I/O – As mentioned in the “How it works” section. 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 kick-outs.
A few things to check when getting errors:
- The service needs to be running at the time of the backup.
- This service also needs to be running as the Local System account.
- NT Service\SQLWriter login needs to be active inside SQL server. This account is designated as no login, which limits vulnerability.
If none of these are causes of your problem, it is a good idea to reach out to your backup solution vendor. You will want to include the following in the email:
- That you checked the three steps listed above
- The event viewer errors or warnings
- The detailed description of what you are having
- How often the problem occurs