This Quick Guide presents techniques and strategies for restoring Virtual Machines from the Microsoft Hyper-v service using the VSS Bacula Enterprise Plugin.
Bacula Systems provides a single plugin for Bacula Enterprise Edition that permits you to backup a number of different components on Windows machines. One of those components is Microsoft Hyper-V Server, which is the subject of this white paper.
Hyper-v Differential and Incremental backups should be supported for 2nd generation Virtual Machines. For 1st generation and other scenarios, data size and transfer reduction techniques rely on Bacula Global Endpoint Deduplication plugin.
The plugin must be installed in the Hyper-v Host machine and already contains a Bacula Client (bacula-fd) working service.
Download and execute the VSS installation package from the Enterprise Bacula customer repository, or contact us to receive them.
Restart the Windows bacula-fd service to load the installed plugin (service.msc).
As shown in Figure 1, the VSS Plugin for Hyper-v backup can be configured using bweb.
Figure 1. Hyper-v Machines FileSet Plugin Option
The “vss:/@HYPERV/” will try to backup all Hyper-v hosts virtual machines, and the “alldrives: snapshot” is important because the Hyper-v plugin requires to snapshot the VM disk volumes. Instead of using the alldrives plugin option, is it also possible to just Include any dummy file in the FileSet backup, such as an empty txt file like “C:/bacula_backup.txt”, one for each different Windows volume with Hyper-v disks.
It is also possible to include or exclude specific machines, using name filters:
vss:/@HYPERV/ cinclude="Host Component" cinclude=*/TestVM cexclude=* alldrives: snapshot
Hyper-V uses one of two mechanisms to back up each VM. The default backup mechanism is called the “Saved State” or “Offline” method, where the VM is put into a saved state during the processing of the PrepareForSnapshot event, snapshots are taken of the appropriate volumes, and the VM is returned to the previous state during the processing of the PostSnapshot event.
The other backup mechanism is called the “Child VM Snapshot” or “Online” method, which uses VSS inside the child VM to participate in the backup. For the “Child VM Snapshot” method to be supported, see the conditions in the referenced white paper.
If everything is set up correctly as above then the backup will include the Hyper-V data. The VMs data will appear in bweb, bat or bconsole, under the following directory:
From the files selection, it is possible to select one or more machines for restore, as in the example:
$ lsmark *@HYPERV/ *Microsoft Hyper-V VSS Writer/ *Host Component/ *:component_info_5215da3c *c:/ *programdata/ *microsoft/ *windows/ *hyper-v/ *initialstore.xml *resource types/ *06ff76fa-2d58-4baf-9f8d-455773824f37.xml *118c3be5-0d31-4804-85f0-5c6074abea8f.xml *146c56a0-3546-469b-9737-fcbcf82428f4.xml *dacdcf3f-6f67-4eb8-a4d0-5d93b48a2468.xml *f6293891-f32f-4930-b2db-1a8961d9cb75.xml *Offline/ *ubuntu/ *:component_info_5215da3c *c:/ *programdata/ *microsoft/ *windows/ *hyper-v/ *virtual machines/ *690f5094-ff23-411e-92c0-639fc7ebc598/ *690f5094-ff23-411e-92c0-639fc7ebc598.bin *690f5094-ff23-411e-92c0-639fc7ebc598.vsv *690f5094-ff23-411e-92c0-639fc7ebc598.xml *vm/ *ubuntu.vhdx
If the where=/ (origin) restore option value is set, Bacula will overite an existant VM with the same machine when restoring, directly to the Hyper-v service. If the backed up machine does not exist anymore, it is necessary to restore the VM disk to a directory (e.g. where=C:/bacula-restores) and recreate the machine using the Hyper-v console.
Granular File-Level Restore
As shown in Figures 2 and 3, to restore a set of files from a Hyper-V VM backup without re-importing the entire VM, it is possible to restore VHD files in a directory using the without_vss plugin restore option and mount them in the system.
Figure 2. Windows VHD Attach/Mount Server Manager Option
Figure 3. Detach/Unmount Server Manager Option
Once mounted, the VHD image is accessible like other physical disks on the system. The Powershell Mount-VHD command can also be used:
Mount-VHD –Path c:testtestvhdx.vhdx -ReadOnly
More information about the Mount-VHD command can be found on https://technet.microsoft.com/en-us/library/hh848551.aspx.
Backup using the Windows Hyper-V Plugin Using Bacula Enterprise Edition Version – http://baculasystems.com