Volume shadow copy services for dummies (VSS)
Have you ever imagined what could have happened if traffic signals did not exist on the busiest roads? How will the vehicles and human beings cross the junction where several vehicles keep moving ? I bet roads won’t be a safer place. Hence we devised a protocol on the road junctions with signals where red light means ‘hard stop or Freeze’, orange light means ‘Prepare to stop’ and green light means ‘Go’ . Therefore, traffic signal controls the safe passage of the humans and vehicles by freezing the traffic. People who follow this protocol can ensure their safety and for others who don’t , their safety is not guaranteed.
Lets come to the point, Windows server consists of different applications writing data randomly onto the underlying storage disks . Any writes performed by the application passes through intermediate buffers (cache / File system buffer / disk buffer etc.) and applications may also move from one state to another via several intermediate states. Therefore, If we decide to capture / backup the state of the system for any future disasters or catastrophic failures and start reading from the disks we may end up reading partial / inconsistent state of the application.
Similar to traffic signal protocol where orange light (prepare to freeze), Red light (freeze) and green light(Go), VSS Framework is a set of COM service api’s which controls the application data traffic in a windows operating system by freezing the data traffic and providing safe passage for the backup applications to capture the consistent system state.
During the prepare for freeze state , VSS sends events to the adhering applications. In response to the events, the application can either flush any partial writes from cache or commit or rollback any partial states on to the disk thereby bringing application to a consistent state.
During the freeze state, events are sent to applications to freeze their writes and VSS Provider (one of the components of the framework) can capture the snapshot of the volume either by software providers by creating Copy on write snapshots or by using hardware providers storage array snapshots are created.
At last all the applications are sent with a thaw event to resume writing.
Introduction to VSS framework
VSS framework consists of three main components VSS Requestors, VSS writers and VSS Providers.
Backup application creates a requestor component to coordinate with the writers and providers. Requestors instructs the VSS framework to create application consistent snapshot via DoSnapshotSet api.
Any windows application which wants to obey the protocol needs to implement the VSS writer interface and all the application data needs to be written via the application writer.
Providers are the components which helps in creating the snapshot of the system. Windows operating system include the default software providers which are capable of taking Copy on write snapshots whereas hardware providers needs to be implemented by the backup vendors for their respective backend storage array.
Detailed working of the VSS can be found here https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss