Save to My DOJO
The Volume Shadow Copy Service (VSS) is tightly integrated with Windows XP and later versions of the Windows Operating Systems. Microsoft developers put together the efforts to design a centralized component which allows Windows applications (Windows Server Backup) and third party applications to initiate backup or restore requests for Hyper-V Virtual Machines with the help of Volume Shadow Copy Service.
The Hyper-V Host makes use of Volume Shadow Copy Service (VSS) to backup and restore Virtual Machines running on Hyper-V. Any software vendor has to integrate VSS component in their backup application to trigger events for backing up and restoring Virtual Machines. Microsoft provides backup of Virtual Machines with the help of its Virtual Machine component called; Integration Services. Integration Services must be installed in a Virtual Machine before the backup operation can be carried successfully. Integration Services implements a component called Hyper-V VSS Requester Service. Hyper-V VSS Requestor Service is running as a service in each Virtual Machine on Hyper-V Host. Learn more about Hyper-V Integration Services.
Hyper-V Backing up Virtual Machine Process
Any backup product designed specifically for backing up Virtual Machines running on Hyper-V Host follows two mechanisms to initiate backup of the Virtual Machines:
- Saved State of the Virtual Machine
- Child Virtual Machine Snapshot
Both the mechanisms trigger two events; PrepareForSnapshot and PostSnapshot events which are explained shortly.
Saved State of the Virtual Machine
Saved State of the Virtual Machine is used only if the following conditions are true:
- Hyper-V VSS Requestor Service is not running on the Virtual Machine
- The Virtual Machine Operating System is running Windows 2000.
- The integration Services component is not installed
- Hyper-V VSS Writer is not registered.
For more detail read Requirements for Live Backup of a Hyper-V Guest VM with Hyper-V VSS writer.
As part of this process, the Virtual Machine is put into Saved state and then resumed when the backup is completed successfully of the volume holding the Virtual Machine files. This process is undesirable and many of the backup application vendors do not prefer to go with this approach but as part of the best practice for software designing, vendors must include both the processes. The Saved State of the Virtual Machine does not use Volume Shadow Copy Service. Instead, it uses Windows Native APIs to initiate a backup request for Virtual Machines.
The following operation takes place as part of the Saved State of the Virtual Machine process:
- PrepareForSnapshot Event is triggered by the backup application to prepare the Virtual Machine for backup which, in turn, saves the Virtual Machine states.
- Backup is completed by the Hyper-V VSS Writer running under VMMS.exe process.
- Backup application takes the backup.
- PostSnapshot Event is triggered by the backup application.
- Finally, the Virtual Machine is returned to the normal state.
Note: Saved State of the Virtual Machine is sometimes called “Offline Backup of Virtual Machine”.
Child Virtual Machine Snapshot / Live (Hot) Backup of Virtual Machines
Child Virtual Machine Snapshot mechanism is a preferable method and many of the backup applications designed for Hyper-V use this mechanism including Altaro Hyper-V Backup. This mechanism uses Hyper-V VSS Requestor Service which is running in the Virtual Machine as shown in the below figure:
Child Virtual Machine Snapshot mechanism requires that following conditions are true:
- The integration Services component is installed in the Virtual Machine
- Hyper-V VSS Requestor Service is running as part of the Integration Services component
- The Virtual Machine must be running for the backup to be processed by the VSS component
- Snapshot file location must not be set to a different location. If it is different location then make sure to include the volume where snapshot files reside of the Virtual Machine being backed up.
- Dynamic Disks configured inside a Virtual Machine do not support this mechanism. Hence, ensure to configure Basic Disks so backup operation is successful.
- All disks in the Virtual Machine must be formatted with NTFS partition
Again, more detail can be found here.
The following operations take place as part of the Child Virtual Machine Snapshot process:
- PrepareForSnapshotEvent is triggered by the VSS to prepare the Virtual Machine for backup.
- Virtual Machine VSS Writer (part of the Hyper-V Virtual Machine Management Service runs in the VMMS.exe windows process) sends a request to Hyper-V VSS Requestor Service running inside the Virtual Machine to generate a snapshot.
- Hyper-V VSS Requestor Service receives the request and snapshot is created.
- Once the snapshot is created, Hyper-V VSS Requestor Services returns the control to Hyper-V VSS Writer.
- PostSnapshotEvent is triggered by the VSS Writer to let backup application know that the snapshot is completed on the Virtual Machine.
- The application processes the actual backup of the Virtual Machines by copying the snapshots which were generated by the Hyper-V VSS Requestor Service.
Note: Child Virtual Machine Snapshot is known as “Online/Hot/Live Backup of Virtual Machines”.
Hyper-V Restoring Virtual Machine Process
As stated in earlier sections, it is the Hyper-V VSS Requestor Service component which plays an important role when it comes to backing up Hyper-V Virtual Machines running on Hyper-V Server using either Offline – Saved State of the Virtual Machine or Online – Child Virtual Machine Snapshot.
There is no function of Hyper-V VSS Requestor Service component when it comes to restore a Virtual Machine on the Hyper-V Host but the Hyper-V VSS Writer component running as part of the VMMS.EXE process which plays an important role in restoring the Virtual Machines.
The restore operation involves deleting Virtual Machine completely from the Host which involves downtime as well. There’s a lot happening when it comes to restore a Virtual Machine.
Same as Backup process, Hyper-V Restore process triggers two events; PreRestore and PostRestore as explained in the below steps:
- Hyper-V backup applications request a restore operation. The request is sent to the Hyper-V VSS Writer.
- The Hyper-V VSS Writer receives the request and triggers PreRestore event. As part of the triggering process, the Virtual Machine, which is being restored, is deleted from the Hyper-V Host.
- Once the Virtual Machine is deleted, Hyper-V VSS Writer carries out the following operations:
- Restores the files for the Virtual Machine.
- Once the restoration of the Virtual Machine is completed, PostRestore event takes place.
- Registers the Virtual Machine with the Hyper-V Server or Virtual Machine Management Service running under VMMS.exe process.
- Compare the location of restored VHD files with Virtual Machines and update the Virtual Machine configuration files, if any.
- Network Configuration is also updated as part of the PostRestore event.
Considerations for Backup and Restore Process
- Partial backups of the Virtual Machines are not supported. If the above process fails in between for some reasons the entire snapshot is deleted and the application must regenerate the backup request.
- Since Pass-Through disks and iSCSI disks are not visible to the Hyper-V VSS Requestor Service running inside the Virtual Machines, therefore these volumes are not backed up. You must backup the Hyper-V Host if you need to backup these volumes.
- For any Virtual Machine which is part of the Failover Cluster, the Virtual Machine backup must be taken by saving the Virtual Machine state using the Failover Cluster Manager. Failover Cluster may trigger a failover event if a Virtual Machine is taken offline using the Hyper-V Manager
- For a Virtual Machine in Failover Cluster, it is advised to take the Virtual Machine resource offline before proceeding with the restore operation.
Not a DOJO Member yet?
Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!
2 thoughts on "Backing Up and Restoring Virtual Machines in Hyper-V"
I use Altaro Hyper-V Backup, which does indeed backup my VM’s, but I do find the actual backups to be huge, often comprising of a whole VHDX, when certainly not all the drives data has changed. This ‘feature’ is predominantly on my SBS 2011 VM, but does occur on others too, and not all the time. I have found that I need approx 2TB of storage to retain several versions of my VM’s. I realise this is purely anecdotal but the file sizes are substantial none the less.
Hi Steve,
There are some situations where the incremental backups end up a bit larger then they should be. The good news is that we will very soon be releasing Altaro Hyper-V Backup v4 and in the new v4 we improved the storage algorithm substantially. With the new v4 you will have much smaller backups 🙂
Coming soon …
Thank you Steve. 🙂