Volume Shadow Copy (VSS): The Mechanism and the Practice — Why Backup Software Can Copy Files That Are Still in Use
· Go Komura · Windows, VSS, Backup, Files, NTFS, Business Applications, Bug Investigation, Information Systems
“I tried to copy a file another application had open, and got told the process cannot access the file because it is being used by another process.” “We were asked to back up the data folder without stopping the core system.” “Why can backup software calmly copy a database file that’s in use?” — Whether you develop business applications or run file servers, these are questions you run into sooner or later.
At the centre of the answer is the Volume Shadow Copy Service (VSS). It has been built into Windows for more than twenty years, and Windows Server Backup, System Restore, and virtually every commercial backup product all sit on this same foundation.1
This article is aimed at business-application developers who are asked to add “copy a file that’s in use” functionality, and at IT staff who operate backups of file servers and business PCs. Drawing on primary sources as of August 2026, it sets out VSS’s cast of characters and how it works, the day-to-day practice of operating it with vssadmin, and where the line should sit on how far a developer should get involved with VSS. The “Depths of Windows I/O” series looked inside the Cache Manager and NTFS; this article is its sequel, covering the “snapshot” layer that sits directly above the volume.
1. The Bottom Line First
- VSS is a set of COM interfaces and a coordinating service that make it possible to back up a volume while an application keeps writing to it. It has been built into Windows since Windows XP.2
- There are three roles plus a coordinator. The VSS service mediates between the requester that asks for a shadow copy (backup software), the writer that guarantees data consistency on the application side (SQL Server, for example), and the provider that actually creates the snapshot.1
- Windows’ standard system provider uses copy-on-write. Rather than duplicating the entire volume, it moves only the blocks that get overwritten after the snapshot — and only their pre-write content — into a diff area. The diff area has to sit on an NTFS volume.1
- A point of consistency is created through “freeze the writers (up to 60 seconds) → create the snapshot (within 10 seconds) → thaw.” If either time limit is exceeded, creation is aborted and the requester tries again.1
- Whether a writer cooperates changes the quality of the copy. A snapshot taken without a writer’s cooperation is equivalent to “the disk at the instant the power was cut” (crash consistent); one taken with cooperation has already had logs rolled and caches flushed, leaving a consistent state that the application itself guarantees is recoverable (application consistent).31
- vssadmin is the tool for checking operational state. Use list shadows / list writers / list shadowstorage to see the current state, and resize shadowstorage to adjust the diff area’s limit. When the diff area runs out, the oldest shadow copies are silently deleted.451
- Building a VSS requester into your own application is a substantial undertaking. It’s a COM-based native API with no official .NET wrapper. In most cases, retries, adjusting the share mode, or a short stoppage are enough; if VSS really is needed, scripting DiskShadow is the practical answer (Windows Server only).67
- A shadow copy is not itself a backup. Because the copy-on-write differential depends on the intact blocks of the original volume, it offers no protection against a failure that takes out the original volume entirely, such as a disk failure or theft. It can’t be relied on against ransomware either, because shadow copies themselves can be deleted (Section 7.3) or the diff area can be exhausted by mass rewrites (Section 7.4). It only becomes meaningful when combined with backups kept on separate media.1
2. Setting Up the Problem — Why Can’t a File in Use Just Be Copied Normally?
The starting point is Windows’ file sharing mode. When you open a file in Windows (CreateFile), you declare, as the share mode (dwShareMode), what you will allow other processes to do while you have it open. While a process is holding the file open in a way that does not permit read sharing, any process that later tries to open it for reading fails with a sharing violation (ERROR_SHARING_VIOLATION, error 32).8 In .NET this is the familiar IOException (“The process cannot access the file because it is being used by another process”).
The important point is that this is not a bug, but the correct mechanism for protecting data. If a file being written to is read partway through, the reader ends up with a half-finished, in-progress state. As covered in detail in “Mutual Exclusion Fundamentals for File-Based Integration - Best Practices for File Locks and Atomic Claims”, the design of mutual exclusion is the foundation of integration between applications.
But this correct mechanism runs fundamentally at odds with backup.
- The sharing-violation wall: a file that a database or business application keeps open may not even be openable as a copy source in the first place.
- The consistency wall: even if you can open it (because read sharing is permitted), copying takes time. Because the application keeps writing while the copy is in progress, the first and second halves of the file can end up reflecting different points in time, or multiple files (the data file and its log, say) can end up out of step with each other. And as we saw in the “Cache Manager” instalment, a write lands in the in-memory cache first, so looking only at the file on disk doesn’t guarantee you’re seeing the latest content.
- The operational wall: “then just stop the application and copy it” is a reasonable answer in principle, but it isn’t acceptable for a business system or file server that runs around the clock.
In other words, what’s actually wanted is “a copy of a single, consistent instant, without stopping the application.” That’s too much for individual applications to solve on their own, so VSS was built as an OS-level mechanism to provide it. VSS is offered as a COM-interface framework that makes it possible to back up a volume even while an application keeps writing to it.2
3. VSS’s Cast of Characters — Requester, Writer, Provider
VSS’s structure breaks down into three roles and the service that mediates between them.1
| Role | What it handles | Example |
|---|---|---|
| VSS service | Coordination between the roles. Part of Windows | The VSS engine itself |
| Requester | Software that asks for a shadow copy to be created (or imported, or deleted) | Backup software in general. Windows Server Backup and DiskShadow are also requesters |
| Writer | The component on the application side that guarantees the consistency of the data being backed up | Provided by products such as SQL Server or Exchange Server. Writers for Windows components such as the registry ship with the OS |
| Provider | The component that actually creates and maintains the shadow copy | Windows’ standard system provider (copy-on-write). Storage-array vendors also supply hardware providers |
The elegance of this division of labour is that products which know nothing about each other can still cooperate. The backup software (the requester) knows nothing about SQL Server’s internal structure, but SQL Server’s writer declares, as metadata, which files (components) need to be backed up, and puts its own data in order immediately around the point of consistency — so the requester can take a consistent backup simply by following that lead.19 Nearly every third-party backup product that runs on Windows is a VSS requester.1
In IT operations, the moment you actually need to think about these three roles is troubleshooting. Whether a backup failure is a problem with the requester (the software side), a specific writer (the application side), or the provider / diff area (the infrastructure side) changes entirely where you should be looking (Sections 5 and 7).
4. How Snapshots Work — Copy-on-Write and the “Point of Consistency”
4.1. Copy-on-Write — Preserving “That Instant” Without Duplicating the Volume
Hearing the word “snapshot” makes you imagine duplicating the whole volume, but the method Windows’ standard system provider actually uses is copy-on-write. At the moment the snapshot is taken, almost nothing is copied. Later, when a block on the original volume is about to be overwritten, the pre-write content of that block is moved into the diff area (the shadow copy storage) before the overwrite completes, and only then is the write allowed through.1 The move only has to happen the first time each block is overwritten; overwriting a block that has already been moved does not grow the diff area any further.
| Point in time | Original volume | Diff area |
|---|---|---|
| T0: snapshot taken | 1 2 3 4 5 | (empty) |
| T1: block 3 is overwritten | 1 2 3’ 4 5 | 3 (pre-write content moved here) |
| T2: reading the shadow copy | blocks 1, 2, 4, 5 are read from here | block 3 is read from here |
To read “the volume as it was at that instant”, the blocks that haven’t changed are read from the original volume, and the blocks that have changed are read from the diff area, and the two are combined. Because only the changed portion is ever copied, creation is instantaneous and the space it consumes is only the differential. The flip side is that the more heavily a volume is written to, the faster the diff area is consumed (foreshadowing Section 7), and the diff area sits on an NTFS volume on the same machine as the source data.1 What underpins this mechanism is the system provider’s component file, swprv.dll, and the driver that intercepts a volume’s I/O, volsnap.sys.1 If you’re interested in the “how” of intercepting the I/O stack, see also “Filter Drivers and Minifilters”.
There are also other methods: full copy, which splits off a mirror, and redirect-on-write, which writes changes to a separate volume; hardware providers use whichever method suits the storage array best.1
4.2. The Flow of Creating a Point of Consistency — 60 Seconds to Freeze, 10 Seconds to Create
If copy-on-write is about how the data is preserved, VSS’s real value lies in which moment’s state gets preserved — in other words, how the point of consistency is created. Shadow copy creation proceeds as follows.1
flowchart TB
R["Requester asks for creation<br/>enumerates writers, collects metadata"] --> M["Each writer declares its backup targets<br/>components, as XML"]
M --> P["Each writer prepares its data<br/>rolling logs, flushing caches, etc.<br/>reaching a recoverable, consistent state"]
P --> F["Freeze the writers' write I/O<br/>reads still allowed, up to 60 seconds"]
F --> FS["VSS flushes file system buffers<br/>and freezes the file system"]
FS --> C["Provider creates the shadow copy<br/>within 10 seconds, write I/O stays frozen"]
C --> T["File system released, writers thawed<br/>applications resume writing"]
T --> B["Requester runs the backup from<br/>the shadow copy, taking as long as needed"]
Figure 1: The flow of shadow copy creation. Everything actually stops for only a few seconds to a few tens of seconds; the backup itself runs against the snapshot afterwards
There are three points to note.
- The application only stops for the instant it takes to create the point of consistency. The freeze is capped at 60 seconds, and creation (the commit) by the provider is capped at 10 seconds; exceed either and creation is aborted and the requester tries again.1 The backup proper, which can take hours, runs against the finished, read-only shadow copy while the application keeps running.
- Reads are still possible during the freeze. Only write I/O stops.1
- The file system is also frozen. Because VSS flushes the file system buffers before freezing, writes that were sitting in the cache, and the file system’s metadata, are reflected in the snapshot in a consistent order.1
4.3. Crash Consistency and Application Consistency
This is where an important distinction that determines backup quality comes in.
A shadow copy created without a writer’s cooperation is in what Microsoft’s terminology calls a crash consistent state. The official definition is “a disk state equivalent to the state that would be found after a catastrophic failure that abruptly shuts down the system,” and restoring from it is described as “equivalent to a restart following an abrupt shutdown.”3 As a file system it isn’t corrupted, but from an application’s point of view it’s “the instant the power was pulled while it was writing.” A database with a transaction-log recovery mechanism can often recover from this, but recovery processing has to run first — it’s a precondition, not a bonus.
With a writer’s cooperation, each writer rolls its transaction log and flushes its caches immediately before the point of consistency, bringing the data into a consistent state that the application itself guarantees it can recover correctly from.1 This is application consistency, and it’s the whole reason the writer mechanism exists. What’s worth noting is that what a writer guarantees is “a consistent, recoverable state as far as the application is concerned” — it does not silently commit and complete in-flight transactions on your behalf. Uncommitted work is rolled back on restore, the same way it would be in ordinary database recovery. A writer delivers this guarantee of quality without stopping the application, using nothing more than a freeze lasting a few tens of seconds.
The reason backup software has settings such as “use VSS” or “guarantee application consistency” is precisely this distinction. For a plain set of files on a file server, crash consistency is rarely a problem; but on a server hosting a database or mail store, whether the corresponding writer is healthy is, in itself, the quality of the backup.
5. Operating VSS Day to Day — vssadmin and “Previous Versions”
The tool IT staff use in practice to check VSS’s state is vssadmin (run it from an elevated Command Prompt). The current command reference lists list shadows / list writers / delete shadows / resize shadowstorage as available on both client and server.4 The Windows Server–oriented reference additionally lists create shadow / list shadowstorage / list providers, among others.5 Note that vssadmin can only manage shadow copies created by the system provider.1
| Command | What it shows | Where it’s used in practice |
|---|---|---|
vssadmin list shadows |
The list of existing shadow copies — creation time, target volume, shadow copy volume name | Checking how far back in time you have a usable point of consistency for restore. Checking for leftover clutter after backups |
vssadmin list writers |
The list of registered writers with their state | The first triage step when backup software fails with a VSS error — which writer, and therefore which application, has failed |
vssadmin list shadowstorage |
Usage, allocation, and limit of the shadow copy storage (diff area) | Investigating “a previous version has vanished” — whether the limit has been hit |
vssadmin resize shadowstorage |
— (changes the diff area’s limit) | Expanding the diff area when it’s too small for the number of generations you want to keep10 |
If list writers shows a writer in an error state, the thing to suspect is not VSS itself but the application that provides that writer. Check the owning application’s service state and the Application/System event logs (Section 7).
resize shadowstorage’s /maxsize lets you specify the limit with a unit such as KB/MB/GB; leave it unset and there is no limit at all. What’s worth noting is that Microsoft’s documentation explicitly states that changing the storage limit — shrinking it in particular — can itself cause shadow copies to be lost.10 Don’t casually shrink the limit on a volume where you want to keep multiple generations.
5.1. The Relationship with “Previous Versions”
Enabling Shadow Copies of Shared Folders on a file server periodically retains point-in-time copies of files on the share, letting users restore a file they’ve deleted or overwritten from Previous Versions without needing an administrator’s help.1 It’s the most familiar application of VSS, and one that reliably cuts help-desk workload.
There is a limit, though. System-provider shadow copies max out at 512 per volume, of which the Shadow Copies of Shared Folders feature keeps up to 64 by default (changeable via the registry value MaxShadowCopies).1 And as covered from the next section onward, if the diff area runs short, the oldest generations are removed automatically. It’s safest to understand that “how many generations you actually keep” is decided not by the number you configured, but by how much is written and the size of the diff area.
6. A Developer’s Perspective — Does Your Own Application Need VSS?
From here on, this is the developer’s perspective. When you’re asked to “add a backup feature that can copy files even while they’re in use”, how should you approach VSS?
6.1. Writing Your Own Requester Is a Substantial Undertaking
The VSS API, for both requesters and writers, is provided as COM and C++ interfaces (the core of a requester is IVssBackupComponents).6 There’s no official .NET wrapper, and you have to correctly implement everything from collecting writer metadata, through managing the snapshot set, to cleaning up after an error — so it isn’t something you can casually bolt on as one feature of a business application. In our own contract-development estimates, “building a VSS requester” is treated as its own separate line item.
There are two realistic answers. First, leave it to an existing VSS-aware backup product. Second, on Windows Server, drive DiskShadow from a script. DiskShadow is the VSS requester that ships with the OS; besides its interactive mode it has a scripting mode (diskshadow /s script.txt), and a single script can cover creating the shadow copy, exposing it as a drive letter (expose), running a batch process that does the copying (exec), and cleaning up afterwards.71 You can build the flow “create a shadow copy → pull files out of it with your own copy logic → delete it” without writing a single line of COM. However, DiskShadow is Windows Server–only and is not included in client editions of the OS.1 If client PCs are also in scope for the requirement, that fact alone tips the balance toward adopting an existing backup product.
6.2. Do You Even Need VSS? — A Decision Table
In our experience, the great majority of “copy a file that’s in use” requests can be solved without VSS. Work out exactly what level of requirement you’re dealing with before you pick a tool.
| Requirement | Realistic answer | Is VSS needed? |
|---|---|---|
| Being able to read a file another application is writing to is fine, even if you have to wait a little | Retry — retry plus a wait interval. A sharing violation is usually a transient state | No |
| The other application permits read sharing | Open with a matching share mode (FileShare.ReadWrite in .NET). But manage the risk of reading a partial write yourself |
No |
| The application can be stopped during a break in business (overnight, a lull) | Copy while it’s stopped. The simplest and most reliable option | No |
| You can agree an integration contract with the other application | Switch to an atomic hand-off design — write and then rename into place, for example (see the mutual-exclusion article) | No |
| You want to replicate an entire set of data from an application that can’t be stopped, in a consistent state | VSS. Look first at an existing backup product, then a DiskShadow script (Server only), and only then a self-built requester | Yes |
6.3. Should Your Own Application Register a Writer?
It’s worth clarifying the reverse question too: should your own business application provide a VSS writer? If you write one, your application’s data gets backed up with application consistency no matter which backup product your customer uses. There is also a lighter-weight mechanism than a normal writer, the express writer (IVssExpressWriter), but all it does is register metadata declaring which files to include or exclude.6 It doesn’t receive freeze/thaw notifications, so it cannot pause your application’s writes to line up with snapshot creation. An express writer is only appropriate when it’s paired with a storage design that isn’t corrupted even if it’s captured mid-write (i.e. crash consistency is enough); if you actually need coordination at the point of consistency, you need a full writer implementation.
That said, the rule of thumb for deciding is simple.
- If your data lives in a database such as SQL Server, you don’t need one. The database’s own writer guarantees consistency.1
- For simple file-based storage, solve it first through the design of the save routine. If you write out completely to a temporary file and then swap it in with an atomic rename, a crash-consistent snapshot will never leave behind a corrupted saved file.
- Registering a writer is worth considering only for applications that maintain a proprietary data store spanning multiple files and need mutual consistency across them at the point of consistency. It may well be worth first reconsidering whether holding that much data in a home-grown format is the right call at all.
7. Pitfalls — Four Things That Really Bite in Operation
7.1. VSS Is Not Itself a Backup
This is the single most important pitfall. A system-provider shadow copy is a differential sitting on the disk of the very same machine as the original data. If the diff area is lost, there’s nothing left to reconstruct from, so it offers no protection at all against a disk failure, a stolen or lost machine, or the encryption of an entire volume. Microsoft’s own documentation draws a clear line between shadow copies and backups: “the content copied from a shadow copy onto media such as tape is the backup, and the shadow copy itself may be deleted once that copy has been made.”1 A shadow copy is a point of consistency and a quick way to recover from a mistake — it is not a substitute for a backup kept on separate media at a separate site.
7.2. A Writer Error Is a Problem on the Application Side
When backup software fails with a “VSS error”, start by identifying which writer has failed, using vssadmin list writers. Because a writer is, in substance, a component belonging to the application (or a Windows component)1, the main battleground for investigating the cause is that application’s service state and its event logs. Getting dragged along by the surface appearance of “an error from the backup software” and continuing to investigate only the backup software leads you the long way round. The general pattern for narrowing this down is the same one covered in “When You Inherit a System With No Source Code and No Documentation — A Practical Playbook for Keeping It Running”: narrow the list of suspects from the facts you can actually observe.
7.3. Ransomware Comes for Your Shadow Copies
This is a fact worth knowing purely as a defensive consideration. It’s tempting to hope that if you can roll back with Previous Versions, you could recover even after being hit by ransomware — but it’s widely known that a great deal of ransomware deletes shadow copies before or after encrypting, specifically to shut off this recovery path. Deleting shadow copies can be done with an entirely legitimate command as long as you have administrator rights, so it can’t serve as a last line of defence against an attacker who has already got in. The pillars of a countermeasure, then, are: (1) treat shadow copies as “handy if they’re there” rather than as “part of the recovery plan”; (2) keep a separate, offline backup at a separate site that an attacker cannot reach; and (3) never grant administrator rights to accounts used for day-to-day operations. For defence across the whole PC lifecycle, including backup, encryption, and disposal, see also “The Practical BitLocker Guide — Starting Drive Encryption With Recovery Key Management” and “What to Do Before Disposing of a Windows PC — A Practical Checklist for Data Erasure, Account Unlinking, and Backups”.
7.4. When the Diff Area Runs Out, the Oldest Generations Vanish Silently
As covered in Section 4, copy-on-write consumes the diff area only when each block is overwritten for the first time after the snapshot was taken. Overwriting an already-moved block any number of further times doesn’t add to the consumption, so how much is consumed is decided not by “how many writes happened” but by “how wide a range of blocks was overwritten since the retained snapshot was taken.” And once the diff area hits its limit, that volume’s shadow copies are deleted, oldest first.1 Nothing is notified to the interactive user, so this often only comes to light when “I should be able to roll back to last week’s version” turns out not to be true any more. It isn’t completely silent, though: the System log does record events from the volsnap source (event ID 25 when a copy is deleted because space couldn’t be freed for the diff area, 35/36 when an extension fails or is aborted after hitting the limit, and so on). Beyond periodic checks, including these volsnap events in your monitoring and alerting lets you catch a loss quickly. The reason bulk operations that “sweep across the whole volume” — mass file updates, batch conversions, defragmentation — can devour the diff area in one go comes down to exactly this property: consumption is decided by the range of blocks overwritten. Regularly check whether the number of generations you’re retaining still meets your business requirement (“at most how many days can pass before someone notices an accidental deletion?”) against the usage shown by vssadmin list shadowstorage, and widen the limit if you need to.510
8. Summary
- The reason a file in use can’t normally be copied is a matter of sharing violations and consistency, and that is the correct mechanism for protecting data. VSS is the OS-level answer to “I want a consistent copy without stopping the application.”
- VSS is a framework in which the VSS service mediates between three roles — requester (asks), writer (guarantees consistency), and provider (creates) — letting backup software and business applications that know nothing about each other cooperate.
- The system provider uses copy-on-write, and a point of consistency is created via “freeze the writers (up to 60 seconds) → create (within 10 seconds) → thaw.” Without a writer’s cooperation you get crash consistency; with it, application consistency.
- Check operational state with vssadmin (list shadows / list writers / list shadowstorage). Suspect the application side for a writer error, and check diff-area usage regularly.
- Developers should first use the decision table to check whether retries, share modes, a stoppage window, or an integration design can solve the problem, and turn to VSS only when it’s genuinely needed. A DiskShadow script (Server only) or an existing product is the realistic answer, ahead of building your own implementation.
- A shadow copy is not a backup. It is nothing more than a differential that depends on the intact blocks of the original volume; it is powerless against the loss of that original volume, as in a disk failure, and it can’t be relied on against ransomware either, given that shadow copies can be deleted or the diff area exhausted. Pair it with an offline backup kept at a separate site.
Related Articles
- Mutual Exclusion Fundamentals for File-Based Integration - Best Practices for File Locks and Atomic Claims
- The Depths of Windows I/O (Part 4) — Cache Manager: When Does Your WriteFile Actually Reach the Disk?
- The Depths of Windows I/O (Part 5) — NTFS Internals: Understanding the File System Through the MFT
- When You Inherit a System With No Source Code and No Documentation — A Practical Playbook for Keeping It Running
- BitLocker Practical Guide — Drive Encryption Starting With Recovery Key Management
- What to Do Before Disposing of a Windows PC — A Practical Checklist for Data Erasure, Account Unlinking, and Backups
Related Consulting Areas
KomuraSoft LLC handles the design and development of business applications with features such as “copy files that are in use” and backup, root-cause investigation of sharing violations around file integration and of backup failures (VSS writer errors), and putting the operational structure of file-server backups and generation management in order. We’re happy to start from the question of whether VSS is even the right requirement in the first place.
- Windows Application Development
- Bug Investigation & Root-Cause Analysis
- Technical Consulting & Design Review
- Contact Us
References
-
Microsoft Learn, Volume Shadow Copy Service (Windows Server). On the division of roles between the VSS service, the requester (backup software — Windows Server Backup and DPM are examples, and nearly every piece of backup software on Windows is a requester), the writer (provided by products such as SQL Server and Exchange Server, with writers for Windows components such as the registry shipping with the OS), and the provider; on the shadow copy creation procedure (collecting writer metadata → preparation by completing transactions, rolling logs, and flushing caches → freezing write I/O for up to 60 seconds, with reads still possible → flushing and freezing the file system buffers → creation by the provider within 10 seconds → thaw, with creation aborted and retried by the requester if a limit is exceeded); on the three methods — full copy, copy-on-write, and redirect-on-write; on the system provider using copy-on-write and the diff area needing to sit on an NTFS volume; on the component files being swprv.dll and volsnap.sys; on that volume’s shadow copies being deleted, oldest first, once the diff area’s free space runs out; on software shadow copies maxing out at 512 per volume, with Shadow Copies of Shared Folders keeping 64 by default (changeable via MaxShadowCopies); on Shadow Copies of Shared Folders letting users restore deleted or modified files without administrator help; on the distinction between a shadow copy and a backup (the content copied to media is the backup, and the shadow copy itself may then be deleted); on DiskShadow being a VSS requester that is Windows Server–only; and on vssadmin being able to manage only shadow copies created by the system provider. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15 ↩16 ↩17 ↩18 ↩19 ↩20 ↩21 ↩22 ↩23 ↩24 ↩25 ↩26 ↩27 ↩28
-
Microsoft Learn, Volume Shadow Copy Service (Win32). On VSS being a set of COM interfaces implementing a framework that lets a volume be backed up while applications on the system keep writing to it, and on its being supported from Windows XP onward. ↩ ↩2
-
Microsoft Learn, VSS Glossary: crash consistent state. On a crash consistent state being “a disk state equivalent to the state that would be found after a catastrophic failure that abruptly shuts down the system”; on restoring from such a shadow copy set being “equivalent to a restart following an abrupt shutdown”; and on this being the default state of data shadow-copied without writer support. ↩ ↩2
-
Microsoft Learn, vssadmin. On vssadmin being a command that displays current volume shadow copies and all installed shadow copy writers and providers, and on the delete shadows / list shadows / list writers / resize shadowstorage subcommands being listed as available on both client and server. ↩ ↩2
-
Microsoft Learn, Vssadmin (Windows Server 2012 R2 and 2012). On the Windows Server–oriented reference listing the vssadmin subcommands add shadowstorage / create shadow / delete shadows / delete shadowstorage / list providers / list shadows / list shadowstorage (lists all shadow copy storage associations on the system) / list volumes / list writers / resize shadowstorage. ↩ ↩2 ↩3
-
Microsoft Learn, Volume Shadow Copy API Interfaces. On the VSS API being provided as COM and C++ interfaces that support building requesters and writers, and on the IVssBackupComponents family of interfaces for requesters, the IVssCreateWriterMetadata family for writers, and IVssExpressWriter for the lighter-weight express writer being defined. ↩ ↩2 ↩3
-
Microsoft Learn, Diskshadow. On DiskShadow being a tool that exposes VSS functionality, with both an interactive command interpreter and a script mode (diskshadow /s script.txt); on execution requiring membership of the local Administrators group; and on commands such as add, create, expose (exposes a persistent shadow copy as, for example, a drive letter), exec (runs a local file), and delete shadows making it possible to write everything from shadow copy creation through exposure to running the backup script in a single script. ↩ ↩2
-
Microsoft Learn, CreateFileW function. On dwShareMode specifying, when a file is opened, the shared access (read, write, delete) permitted to subsequent opens; and on an open that requests access conflicting with an existing handle’s share mode failing with a sharing violation (ERROR_SHARING_VIOLATION). ↩
-
Microsoft Learn, Overview of Processing a Backup Under VSS. On the requester and writer cooperating during backup processing, with the writer declaring the files (components) it is responsible for through read-only metadata (the Writer Metadata Document), and the requester interpreting that to select what to back up and recording it in its own metadata (the Backup Components Document); and on the writer briefly pausing I/O before shadow copy creation and returning to normal operation once it’s complete. ↩
-
Microsoft Learn, Vssadmin resize shadowstorage. On this being the command that changes the maximum size usable as shadow copy storage; on there being no limit on storage usage if /maxsize is not specified; on the value being specifiable in units of KB/MB/GB/TB/PB/EB; and on the warning that resizing a storage association can cause shadow copies to be lost. ↩ ↩2 ↩3
Related Articles
Recent articles sharing the same tags. Deepen your understanding with closely related topics.
Practical Multithreading Best Practices: C Edition — Writing Safely the Win32 API Way
The established approach to multithreading in C with Win32 is thread creation via _beginthreadex, SRW locks and condition variables, Inte...
Practical Multithreading Best Practices: C++ Edition — Eliminating Accidents by Structure with RAII and jthread
In C++, multithreading is a world where a data race is undefined behaviour. This article works through the std::thread destructor trap, d...
Practical Multithreading Best Practices: .NET Edition — What to Decide Before You Add More Threads
A practical rundown of the design rules that keep multithreaded .NET/C# code from occasionally crashing or hanging: ride on Task instead ...
The Windows Certificate Store in Practice — User or Computer, Which Should You Use?
Should a client certificate go in the user store or the computer store? This practical guide works systematically through the classic cer...
The Windows Firewall and Business Applications — Register Inbound Rules From the Installer
"It works on the dev machine but the client can't connect" almost always traces back to the Windows Firewall. This article covers the def...
Related Topics
These topic pages place the article in a broader service and decision context.
Windows Technical Topics
Topic hub for KomuraSoft LLC's Windows development, investigation, and legacy-asset articles.
Bug Investigation & Long-Run Failures
Topic page for intermittent failures, communication diagnosis, long-run crashes, and failure-path test foundations.
Where This Topic Connects
This article connects naturally to the following service pages.
Windows App Development
We support Windows desktop applications that involve resident processing, device integration, operational logging, and maintainable structure.
Bug Investigation & Root Cause Analysis
We investigate difficult production issues such as intermittent failures, long-run crashes, leaks, and communication stoppages.
Frequently Asked Questions
Common questions about the topic of this article.
- If I have shadow copies, do I still need backups?
- No, it doesn't. The shadow copies created by Windows' standard system provider are copy-on-write differentials — they are not a separate, complete copy of the volume at that point in time, but depend on the blocks of the original volume that have not been overwritten. Even if you place the diff area on a separate volume, the fact remains that if the original volume is lost, restoration is impossible, and this offers no protection against events that take out the original volume entirely, such as a disk failure or a stolen or lost PC. The same applies to ransomware: the write operation performed during encryption does move the pre-write blocks into the diff area, but in real attacks the shadow copies themselves are deleted, or the diff area is exhausted by mass rewrites, so you cannot rely on this. Microsoft's own documentation draws a clear line between the two: a backup is the data copied from a shadow copy onto media such as tape, and once that copy has been made the shadow copy itself may be deleted. A shadow copy is a "point-in-time snapshot for taking a backup from" and a "quick way to recover from a minor mistake" — it is not a substitute for a backup kept on separate media at a separate site.
- I want my own business application to copy files that are in use — should I use VSS?
- The realistic first move is to find a way to avoid needing it. VSS requesters have to be written against a COM-based native API (such as IVssBackupComponents), and there is no official .NET wrapper, so building one into your own application is a substantial undertaking. If the requirement is simply "be able to read a file that another process is writing to, eventually", retries are enough; if "the other application permits read sharing", opening the file with a matching share mode is enough. If the application can be stopped for a short time, copying during a natural break in business is the simplest and most reliable option. VSS only earns its place when the requirement is "replicate an entire set of data from an application that cannot be stopped, in a consistent state" — and even then, look first at an existing VSS-aware backup product or a DiskShadow script before building your own implementation.
- vssadmin list writers shows a writer in an error state. What should I do?
- The basic approach is to investigate it as a problem on the side of the application that owns that writer. vssadmin list writers displays the registered writers together with their state, so start by identifying which writer has failed. Because writers are provided by applications such as SQL Server or by Windows components (the registry, for example), the cause is almost always found in the service state of the owning application, or in errors recorded in the Application/System event logs, rather than in VSS itself. Restart the relevant service and narrow down the conditions under which it reproduces; if that doesn't resolve it, check the support information for that application. This is also the correct first triage step when backup software fails with a VSS error.
- A shadow copy disappeared without my noticing. Why?
- The most common cause is the diff area (the shadow copy storage) running out of space. With copy-on-write, the content of each block is moved into the diff area the first time it is overwritten after the snapshot was taken, so the wider the range of blocks that get overwritten, the more of the diff area is consumed. Once the assigned limit is reached, Windows deletes the oldest shadow copies first to free up space. This happens silently, with no notification to the interactive user, so it's typically discovered when someone expects to restore last week's version from Previous Versions and finds it isn't there (the System log does record events such as event ID 25 from the volsnap source, so keeping an eye on that lets you catch it). Check the usage and the limit with vssadmin list shadowstorage, and raise the limit with vssadmin resize shadowstorage if needed. Bear in mind, though, that changing the limit — especially shrinking it — can itself cause shadow copies to be lost.
- How does File Explorer's "Previous Versions" relate to VSS?
- "Previous Versions" is one of the entry points for retrieving past versions of a file from a shadow copy created by VSS. On a file server, enabling "Shadow Copies of Shared Folders" causes shadow copies to be taken on a schedule, and users can right-click a file on a shared folder and restore it themselves from Previous Versions. The benefit is that users can undo an accidental deletion or overwrite without needing an administrator's help. But because it's built on shadow copies underneath, there's an upper limit on how many generations can be kept, and if the diff area runs short, the oldest generations disappear first. As covered in the body of the article, "we have Previous Versions" does not mean "we don't need backups."