How Windows VSS Creates Point-in-Time Volume Snapshots
In this article
Windows Volume Shadow Copy Service (VSS) creates point-in-time snapshots of volumes, letting you restore previous versions of files, back up open files, and run consistent backups. This guide explains the exact process VSS uses, from the initial request to the final snapshot, and what you need to know to use it effectively.
What You'll Need
- A Windows system (client or server) with NTFS volumes. VSS works on NTFS; it does not support FAT32 or exFAT.
- Administrator privileges to create or manage snapshots manually.
- Sufficient free disk space on the volume (or a designated storage location) to hold the snapshot. The amount depends on how much data changes.
- Optional: A backup application that uses VSS (like Windows Backup or a third-party tool) to automate snapshots.
Step-by-Step
- Request the snapshot. A backup program, System Restore, or a manual command (e.g.,
vssadmin create shadow) sends a request to the VSS service. This request includes the volume(s) to snapshot and the context (e.g., backup, restore, or system restore). - VSS coordinates with writers. VSS identifies all registered VSS writers—components that know how to quiesce their data. Writers include services like SQL Server, Exchange, and the Windows operating system itself. VSS asks each writer to prepare for the snapshot.
- Writers quiesce their data. Each writer flushes its buffers, completes pending I/O, and brings its data to a consistent state. For example, a database writer ensures all transactions are logged and data files are in a stable state. This step is crucial for application-consistent snapshots.
- VSS freezes the volume. Once all writers are ready, VSS instructs the volume to freeze. This suspends all write I/O to the volume for a brief moment. The freeze is short—typically a few seconds—to minimize disruption.
- Create the shadow copy. VSS signals the storage subsystem (usually the volume manager or a hardware provider) to create the point-in-time copy. The provider uses a copy-on-write mechanism: it records the original state of any blocks that are about to be modified. The snapshot itself is a virtual copy—it doesn't duplicate all data immediately; it only saves the differences over time.
- Thaw the volume. After the snapshot is created, VSS releases the freeze. Write I/O resumes normally. This happens quickly, usually within seconds.
- Notify writers. VSS tells each writer that the snapshot is complete. Writers can now resume normal operations and, if needed, perform any post-snapshot tasks.
- Snapshot is stored. The shadow copy is stored in a hidden system folder on the volume (for system restore points) or in a separate storage location. It remains available for read-only access until it is deleted or the system reclaims space.
Common Mistakes
- Not having enough disk space. Snapshots consume space as data changes. If the volume runs out of space, VSS may delete older snapshots or fail to create new ones.
- Forgetting to enable System Protection. On Windows client systems, System Restore points (which use VSS) are often disabled by default. You must enable them for a drive in System Properties.
- Assuming snapshots are full copies. VSS snapshots are not full backups; they are point-in-time views. If you delete the original volume, you lose the snapshot too.
- Using VSS on unsupported file systems. VSS does not work on FAT32 or exFAT. Only NTFS volumes can be snapshotted.
- Ignoring writer failures. If a writer fails to quiesce, the snapshot may be crash-consistent (like a power failure) rather than application-consistent. This can cause issues for databases.
Tips
- Monitor snapshot storage. Use
vssadmin list shadowstorageto see how much space is being used and adjust the maximum size if needed. - Schedule snapshots wisely. For regular backups, schedule them during off-peak hours to minimize the impact of the freeze on active users.
- Test your snapshots. Periodically restore a file from a snapshot to ensure it works as expected.
- Use hardware providers when available. If your storage system supports VSS hardware providers, they can create snapshots faster and with less overhead than the default software provider.
- Keep the volume defragmented. Fragmentation can increase the number of copy-on-write operations, making snapshots slower and larger.
Troubleshooting
Snapshot creation fails. Check the Event Viewer for VSS errors (Event IDs 13, 14, 12289, etc.). Common causes include insufficient disk space, a full shadow storage area, or a writer that is stuck. Try restarting the Volume Shadow Copy service (net stop vss then net start vss) and retry.
Snapshots are deleted unexpectedly. This often happens when the system is under disk pressure. VSS automatically deletes older snapshots to free space. Increase the maximum shadow storage size or reduce the frequency of snapshots.
Writers are not responding. Use vssadmin list writers to see the state of each writer. If a writer shows "Failed" or "Unknown", restart the associated service. For example, for the System Writer, restart the Volume Shadow Copy service.
Cannot access previous versions. Ensure the volume has System Protection enabled and that there are restore points. If the volume is not NTFS, previous versions won't work.
Snapshot is inconsistent. This can happen if a writer failed during the freeze. Check the writer status and ensure that the application (e.g., SQL Server) is properly configured for VSS backups.
Frequently Asked Questions
Q: How much disk space does a VSS snapshot use?
A: It varies. Initially, a snapshot uses very little space, but as data changes, the copy-on-write mechanism saves the old blocks, consuming space. The maximum is set by the shadow storage limit, which defaults to 10% of the volume size.
Q: Can I create a snapshot manually?
A: Yes. Open an elevated command prompt and run vssadmin create shadow /for=C: (replace C: with your drive). This creates a snapshot that appears as a hidden drive letter.
Q: How long does a snapshot last?
A: Snapshots are not permanent. They are kept until they are deleted, the system runs out of shadow storage space, or the volume is formatted. System Restore points are typically kept for a limited time based on storage settings.
Q: What is the difference between a crash-consistent and application-consistent snapshot?
A: A crash-consistent snapshot is like the state after a power failure—it's a point-in-time copy, but applications may not have flushed all data. An application-consistent snapshot involves writers quiescing, so databases and services are in a known good state.
Q: Does VSS work on SSDs?
A: Yes, VSS works on SSDs. However, the copy-on-write mechanism can cause additional writes, which may affect SSD longevity, but modern SSDs handle this fine.
Q: Can I use VSS to back up the entire system?
A: Yes, Windows Backup uses VSS to create system image backups. You can also use third-party tools that leverage VSS for full system backups.