Home > Backup and Recovery Strategies Blog > Hyper V backup software. How to backup Hyper V virtual machines?
1 Star2 Stars3 Stars4 Stars5 Stars
(14 votes, average: 5.00 out of 5)
Loading...

Hyper V backup software. How to backup Hyper V virtual machines?

  • May 19, 2020, Rob Morrison

Generally speaking, the Hyper V user-base - not to mention the wider VM user-base - is pretty big. Correspondingly, there are a lot of different backup solutions for it that have unique features, services, and more. However, it’s quite a surprise for a lot of people that you can actually backup your Hyper V VMs natively if you’re using Windows Server 2012 or newer. Not only this, but it is a relatively simple process that requires little to no configuration. It’s not ideal to use as a main VM backup source, but can be useful as an additional, dedicated option in certain situations.

Windows Server Backup

This Hyper V backup solution itself is called Windows Server Backup and it can be installed as an additional feature from Server Manager. Both Windows Server Backup and other third party solutions are using snapshot technology to create these backups. A snapshot (or a checkpoint) is a state of the VM in a specific point in time, and it can store virtual disks state, RAM contents and VM-specific settings.

It is worth noting that the cloud backup is also possible with this tool, when configured properly. However, for the sake of showing the basics behind the process, we’ll focus more on the local VM backup process.

The graphical interface of Windows Server Backup

After launching Windows Server Backup, you’ll be able to right-click the “Local backup” line, and you’ll see a number of different options there, like “Backup once”, “Scheduled backup”, and more. Scheduling backups is somewhat more complicated, that’s why we’re going with “Backup once”.

  1. Choosing “Backup once” should bring you the first window of the backup setup process. In this part you’ll have to specify if you’re using scheduled backup or if you want to include other options. Going through several setup windows each time you want to create a backup is necessary because we’re not using any pre-configured options so far. Meaning that we can just click “Next” in this window.
  2. Second part of this process would give you an option to choose between backing up the entire server or choosing specific parts to backup. Since we’re aiming at backing up VMs only, we’re choosing “Custom backup” in this step.
  3. After choosing “Custom backup” and confirming it you’ll be prompted to choose the exact parts of your system that you want to create a backup of. Here we’re clicking on “Add items”, expanding the “Hyper V” line and choosing the specific VM or VMs that we want to create a backup of.
  4. The setup process is pretty much finished with this step that’s prompting you to choose the location of your future backup. Confirming that should give you the ability to finally execute that backup.

The command line interface of Windows Server Backup

However, a lot of users prefer to enact command prompts to create Hyper V backup jobs, since the graphical interface that we’re using to create a backup above is able to support only one VM backup task at a time, and the task you’ve created with the graphical interface would completely overwrite all of the previous backup tasks.

A good example of a simple console command to create a backup of a VM called “Server 1” to a specific folder on disk C: would look like this:

 

wbadmin start backup –backupTarget:C: –hyperv:"Server 1"

Moreover, if you want to backup two or more VMs at once and to have backups saved in a network-shared folder (external NAS storage, basically), the command should look like this:

 

wbadmin start backup -backuptarget:\\192.168.2.15\HVMback: -hyperv:"TestVM01,TestVM02" -allowDeleteOldBackups -quiet

Or if you want to simply see the list of backups that are already created and registered within the system, you’ll have to input the following command:

 

wbadmin get versions

Disadvantages of Windows Server Backup

While Windows Server Backup is a solution that is simple, reliable and fast solution for Hyper V backup purposes, there are several serious drawbacks to it, as well:

  • It’s difficult to manage more than 3-5 Hyper V installations;
  • You can’t monitor backup progress and verify the backup consistency when using Windows Server Backup;
  • Since VM backups most of the time are quite big and pose a significant challenge for your server, you’ll have to schedule them to avoid network and server overloads in the business hours and in general;
  • There’s no way to automatically recover a specific file or a specific app state, everything has to be mounted and copy-pasted manually.

Windows Server Backup is a decent way of creating backups of your VMs, but it has some serious drawbacks that prevents it from being used as a primary backup solution – this role would still stay with third-party solutions. An example of such a solution is Bacula Enterprise’s Hyper V backup software solution.

Bacula Enterprise Hyper V backup solution

Bacula Enterprise’s Hyper V  backup solution is especially flexible, capable of providing a very high number of functions and options, including:

  • Full VM backups on image-level;
  • The ability to restore disk images;
  • Backup encryption both in transit and at rest;
  • Compression of Hyper V VM backups;
  • Complete Hyper V VM image restoration;
  • Fast restore speed for Hyper V VMs;
  • Choice of both command line and web based GUI’s.

As for the actual process of how Bacula Enterprise works – there’s a single plugin that is included in Bacula Enterprise called vss-fd.dll. It enables interaction with a variety of components on Windows-based systems for various purposes. One such component is the Hyper V server or servers.

Both backup and restore jobs are possible for Hyper V VMs with Full level backups. Since Microsoft itself doesn’t support either Incremental or Differential backup for Hyper V servers – there’s no way for Bacula to do that. At the same time, some specific features like global endpoint deduplication or bothsides FileSet option allow the solution to compensate some of the obvious drawbacks of Full backup as the main backup method.

The initial configuration

Of course, everything begins with the configuration step. You’ll have to put a specific command into the Include section of the File Set that you want to use to backup the Hyper V server, this command should activate the Hyper V component of the solution.

 

Plugin = "vss:/@HYPERV/"

This should enable you to backup all of the Hyper V VMs. The step above also has the purpose of specifying the plugin directive that you should set beforehand, and your job may or may not have more than one of the vss components specified.

Double check that your vss-fd.dll plugin is in the Plugin directory that you’ve chosen in the general solution installation process, and that the Plugin Directory itself is specified in the Bacula config file called bacula-fd.conf. An example of the status output from a solution with VSS plugin set properly is shown below.

 

*status client=wsb-sql08-fd

Connecting to Client wsb-sql08-fd at wsb-sql08:9102

 wsb-sql08-fd Version: 8.2.0 (02 Feb 2015) VSS Linux Cross-compile Win64

Daemon started 20-Apr-12 13:14. Jobs: run=15 running=0.

Microsoft Windows Server 2008 R2 Standard Edition Service Pack 1 (build 7601), 64-bit

Heap: heap=0 smbytes=1,061,455 ...
Sizes: boffset_t=8 size_t=8 debug=0 ...
Plugin: vss-fd.dll

Hyper V backup software with Bacula Enterprise

If the entire process above is performed correctly, you’ll have the ability to include the Hyper V data in the backup from now on. The files that you’ll get as a part of the Hyper V backup should appear in a bconsole or in a bat restore in the following form:

 

/@HYPERV/
...
etc

As for the VSS-enabled components, it’s a specific person’s responsibility (namely, the administrator’s) to be absolutely sure that the VSS snapshots are getting created by specifying at least one directory or one file for each drive that has the data handled by the plugin.

There’s two general mechanisms that describe the ways that Hyper V may handle the subject of performing VM backups. There’s the “Offline” method and there’s an “Online” method.

The “Offline” method is also called the “Saved State” method and it’s usually the default mechanism for Hyper V backups. The way it works is that a VM in question is put into a saved state in the preparation stage, a snapshot of the required volumes is taken and then the VM is running again in the post-snapshot stage.

And then there’s the “Online” method, also called “Child VM Snapshot”, it uses a VSS inside the child VM to perform the actual backup, but there’s a few conditions that need to be met before the process begins:

  • All disks inside of that VM must have a snapshot-compatible file system (NTFS, etc.);
  • The child VM must be in the operational state;
  • There’s no dynamic disks in the child VM;
  • Backup Integration Service is up and running within the child VM. The name is “Hyper V Volume Shadow Copy Requestor”;
  • The VHD files for the VM are in the same place that is chosen to be the Snapshot File Location.

It is possible to know that’s the current set backup mode for your VM by typing the following command for Windows 2012 R2:

 

C:/> echo list writers > t.txt
C:/> diskshadow /s t.txt | find "Caption: O"

- Caption: Offline/2012
- Caption: Offline/windows
- Caption: Online/centos

And it’s a bit different for Windows 2008-2012:

 

C:/> echo list writers > t.txt
C:/> diskshadow /s t.txt | find /i "Caption: Backup Using"

  • Offline backups: “Backup using saved state/VMname1
  • Online backups: “Backup using child partition snapshot/VMname2

Hyper V VM restore process with Bacula Enterprise

The VM restore process, on the other hand, is handled entirely by the OS of the host, without involving VSS writers from inside the child VMs. Here’s how this process works:

  1. The Hyper V VSS writer turns off and deletes any VMs about to be restored – all of that at the pre-restore stage of the process.
  2. The files themselves are restored only after all of the VSS writers have turned off.
  3. For each restored VM the Hyper V VSS writer registers that VM in the Hyper V management service.
  4. For each restored VHD a target location is checked for comparison with the one that’s specified for the  actual VM, and corrected, if necessary.
  5. The network configuration gets updated, with the creation of new ports and their connection to the VMs if necessary.

The Hyper V VSS driver does not get the VM re-created if it’s an “Offline” VM that is restored. Fortunately, this process can be started manually with the “New-VM” powershell command, as follows:

 

New-VM -VMName centos -VHDPath C:/VM/centos.vhdx -MemoryStartupBytes 512MB -SwitchName VMNetwork

It’s also possible to restore VSS files directly to disk without interacting with the VSS restorative framework. It is done via Plugin Options menu by setting the without_vss option to “true”.

File level Hyper V restores with Bacula Enterprise

There’s also the matter of file level restore when it comes to working with Hyper V backups. You can restore a set of files from your Hyper V VM backup without restoring the entire VM, it is done my restoring VHD files in a directory with the usage of without_vss plugin, it allows to mount those files within the system and access them like any other physical disk (the mounting is possible via the Powershell command Mount-VHD or the Server Manager Console).

 

Mount-VHD –Path c:\test\testvhdx.vhdx -ReadOnly

It is advisable to perform the restoration of VHD files on an entirely different system to avoid compatibility problems in the restore process. If your without_vss option isn’t set up properly, you’re risking losing the original VM to the Hyper V’s automatic deletion during the restore process.

Conclusion

Bacula Enterprise is a strong choice as a primary backup solution for your Hyper V VMs. As a heavy-lifting enterprise solution, aimed at large organizations with large and complex data environments, Bacula offers a lot of different capabilities, especially in terms of customization, scalability, reliability and above all, security.

About the author

Rob Morrison Rob on LinkedIn

Rob Morrison is the marketing director at Bacula Systems. He started his IT marketing career with Silicon Graphics in Switzerland, performing strongly in various marketing management roles for almost 10 years. In the next 10 years Rob also held various marketing management positions in JBoss, Red Hat and Pentaho ensuring market share growth for these well-known companies. He is a graduate of Plymouth University and holds an Honours Digital Media and Communications degree, and completed an Overseas Studies Program.

3 Comments
  1. Chandler
    Chandler

    Are you telling me that there was a basic Hyper-V backup software within the system this entire time? That’s interesting, I never knew that was a thing in the first place.

  2. Shawn
    Shawn

    It’s quite interesting that, despite the fact that the capabilities of Windows Server Backup are significantly limited, there’s still two completely different ways of performing said backups. That’s an interesting piece of information.

  3. Brendan
    Brendan

    Bacula’s capabilities as one of the Hyper V backup solutions are impressively broad, despite the fact that Hyper v is not that easy to work with in the first place. Truly, an impressive all-around solution.

Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>