How Windows VSS Snapshot works
How does VSS Snapshot work?
If any files are opened or constantly being changed with data sets or some high I/O operations ,it becomes a difficult job to back up that file because the file could be in inconsistent state.
If there is any database file like ntds.dit , DB file etc which experience a high I/O in a business hours and if these files are not continuously monitored and backed up which contains mission critical data of an organization ,any single disaster or fault can cause a damage to that organization.
So, to have an HA or BAU architecture maintained it is always advisable to back up those data in the certain period of time based on their RPO and RTO SLA agreement.
But to have any backup in place while the data are always in inconsistent state ,this is rather a tedious process.
The solution for these came from Microsoft VSS service.
It takes the advantage of concept Point in time Snapshot.
So, here it comes Microsoft Volume Shadow Copy Service, which was first introduced with server 2003 and with client OS like XP and higher with “Previous Version” feature.
Let me try to put things in an order for a better understanding of how this entire process of taking snapshot works.
VSS or Volume Shadowcopy Service has these three main components.
- VSS Service
- VSS Requestor
- VSS Provider
- VSS Writer
Again Vss Provider divided into three categories
- Hardware &
Requestor requests for a shadow copy.
Provider receives that request and let VSS service know about that.
VSS service talks to Writer to prepare data for shadow copy.
The Writer makes the data available for taking the snapshot and lets VSS know about that.
VSS then talks to the provider to create the shadow copy.
Let’s understand that in detail.
VSS Shadow copy service is the most important components among all who co-ordinates with all other components for a smooth and mostly success process.
VSS Requestor is the actual software who requires the shadow copy, it is generally the backup agents installed on the system or Microsoft native requestor .
VSS Writers : This component makes the data available for taking a snapshot, so it has to be kept in mind that the services associated with these components should be in Stable state .
Few of the services are mentioned on the below screenshot.
VSS Providers : This component is responsible for creating and maintaining the shadow copies.
Now the question is how the VSS shadow copy creates?
When VSS Writer gets a request from VSS Service to prepare data for shadow copy, Each Writer simply prepares an “XML” format description of components and data stores that need to be backed up and wait for VSS Service instruction.
When VSS service instructs each writer to prepare their data for a snapshot.
Each writer prepares the data as appropriate, such as completing all open transactions, rolling transaction logs, and flushing caches. When the data is ready to be shadow-copied, the writer notifies the Volume Shadow Copy Service.
Now if any of the files are in open state or in an inconsistent state, VSS service again instructs VSS writers to freeze the applications for a couple of moments.
Now the Writers gets only maximum of 60 sec to free the I/O operations to this application while the shadow copy is taken.
The Volume Shadow Copy Service flushes the file system buffers and then freezes the file system, which ensures that the file system metadata is recorded correctly and the data to be shadow-copied is written in a consistent order.
VSS service then immediately let the provider know to create the shadow copy. For this shadow copy creation, the provider gets only 10 Seconds.
The Volume Shadow Copy Service releases the file system write I/O requests.
VSS tells the writers to resume writing data to the disk that is being shadow-copied.
“Important gotcha – If time gets bar more than its designed time of 60 seconds for writers and 10 seconds for providers, the shadow copy creation gets fail, and the process has to start from the beginning.”