Home -> Enterprise Data Backup and Recovery Methods Blog -> Backup Virtual Machine with Bacula Enterprise – Technical Overview
1 Star2 Stars3 Stars4 Stars5 Stars
(39 votes, average: 5.00 out of 5)
Loading...

Backup Virtual Machine with Bacula Enterprise – Technical Overview

  • January 20, 2019

How to Backup Virtual Machine with Bacula Enterprise Edition?

backup virtual machine
Bacula Enterprise Edition provides tools to backup virtual machine images through their hypervisor backup APIs. Performing backups at this level rather than the traditional file level provides many advantages, though in many cases a combined approach that uses both file and hypervisor backups will provide the best coverage in complex environments with virtual machines. This how-to will cover some of the advantages of adding hypervisor-level backup virtual machines to your Bacula Enterprise installation, and demonstrate the basics of setting up these backups for a HyperV environment.

Some of the major advantages of performing backups at the hypervisor for virtual machines include:

  1. The hypervisor is a convenient central place to orchestrate all backup operations for your virtual environment.
  2. There is no need to install the Bacula client component (FileDaemon) on each virtual machine individually.
  3. New clients are automatically detected and added to the backup, reducing the risk of a machine being 'missed'.
  4. Single file restore is available as long as the hypervisor API allows us to access them, so there is no loss of functionality over file backups.

It's also important to consider some of the potential pitfalls, such as backing up databases running on a virtual machine. In many cases, the virtualization software is able to quiesce the filesystem through the use of guest tools, and this often means that databases can be reliably backed up with a hypervisor initiated backup. However, it may be preferable still to install a backup client and database-aware backup software on these machines for more granular backups of important databases and applications. Bacula Systems support can help determine which is the best approach for a given environment.

Bacula Enterprise Edition – Supported Virtualization Engines

Bacula Enterprise Edition has plugins to backup virtual machines with these hypervisor vendors:

  • VMware
  • Hyper-V
  • KVM
  • Proxmox
  • Xen

Depending on the tools available from the hypervisor, the backup is either snapshot based or file based.
Where possible, such as with VMWare, image based backups allow for incremental backups and single file restores as well using tools like Changed Block Tracking (CPT) and the single file restore capabilities presented by VMWare's backup API.

The Bacula Enterprise Edition virtual machine backup plugins are all configured in a similar way. No matter which hypervisor you use, the process that follows in this how-to is always the same. We will configure Hyper-V backup as an example for backup of virtual machine with Bacula Enterprise Edition.

How-to backup a Hyper-V host with Bacula Enterprise Edition

On your Bacula Director you will have to add a Client resource for the Hyper-V host (in our case a Windows Server 2012R2 with Hyper-V activated), a FileSet resource (if not previously created for a different backup client, in Bacula all resources can be reused) and finally a Job resource that defines all parameters of the backup job (when it is scheduled with which level for which fileset etc). Please find an example configuration below:

Excerpt from bacula-dir.conf

Job { Name = "HyperV-job" JobDefs = "DefaultJob" Client = win2012-client FileSet = "Hyper-V" Accurate = "Yes" } FileSet { Name = "Hyper-V" Include { Options { signature = MD5 } File = "C:/dummy.txt" Plugin = "vss:/@HYPERV/" } } Client { Name = win2012-client Address = 192.168.178.32 FDPort = 9102 Catalog = MyCatalog Password = "windowspw" File Retention = 60 days Job Retention = 6 months AutoPrune = yes }

This is everything you need to get started. The plugin line in the fileset tells Bacula to back up all virtual machines found on this hypervisor. Please note that the FileSet contains a reference to a dummy text file that is necessary because the VSS snapshot of a Microsoft NTFS filesystem is triggered only if at least one file is specified. With that being said: If your Hyper-V data is spread across several drive letters you will need either a dummy text file on each of them (unless you also do additional file backups on that Windows Server anyway), or you will need to make use of the Alldrives Plugin that comes with the Bacula Enterprise client for Windows.

The backup Job above named "HyperV-job" was executed and finished successfully. Below we show the joblog for this backup job:

Backup joblog

22-Jun 09:26 centos6-64-dir JobId 4: No prior Full backup Job record found. 22-Jun 09:26 centos6-64-dir JobId 4: No prior or suitable Full backup found in catalog. Doing FULL backup. 22-Jun 09:26 centos6-64-dir JobId 4: Start Backup JobId 4, Job=HyperV-job.2018-06-22_09.26.08_12 22-Jun 09:26 centos6-64-dir JobId 4: Using Device "FileChgr1-Dev2" to write. 22-Jun 09:26 centos6-64-sd JobId 4: Volume "Vol-0001" previously written, moving to end of data. 22-Jun 09:26 win-ud8s2399ti8-fd JobId 4: VSS plugin start backup Job. 22-Jun 09:26 win-ud8s2399ti8-fd JobId 4: Generate VSS snapshots. Driver="Win64 VSS" 22-Jun 09:26 win-ud8s2399ti8-fd JobId 4: Snapshot mount point: C:\ 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "Task Scheduler Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "VSS Metadata Store Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "Performance Counters Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "System Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "Microsoft Hyper-V VSS Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "ASR Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "WMI Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "Registry Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "COM+ REGDB Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 win-ud8s2399ti8-fd JobId 4: VSS Writer (BackupComplete): "Shadow Copy Optimization Writer", State: 0x1 (VSS_WS_STABLE) 22-Jun 09:28 centos6-64-sd JobId 4: Elapsed time=00:02:15, Transfer rate=22.30 M Bytes/second 22-Jun 09:28 centos6-64-sd JobId 4: Sending spooled attrs to the Director. Despooling 13,343 bytes ... 22-Jun 09:28 centos6-64-dir JobId 4: Bacula Enterprise centos6-64-dir 8.10.2 (25Apr18): Build OS: x86_64-redhat-linux-gnu-bacula-enterprise redhat JobId: 4 Job: HyperV-job.2018-06-22_09.26.08_12 Backup Level: Full (upgraded from Incremental) Client: "win2012-client" 8.10.2 (25Apr18) Microsoft Datacenter Edition (build 9200), 64-bit,Cross-compile,Win64 FileSet: "Hyper-V" 2018-06-22 09:22:15 Pool: "File" (From Job resource) Catalog: "MyCatalog" (From Client resource) Storage: "File1" (From Job resource) Scheduled time: 22-Jun-2018 09:26:06 Start time: 22-Jun-2018 09:26:10 End time: 22-Jun-2018 09:28:25 Elapsed time: 2 mins 15 secs Priority: 10 FD Files Written: 36 SD Files Written: 36 FD Bytes Written: 3,011,737,880 (3.011 GB) SD Bytes Written: 3,011,748,601 (3.011 GB) Rate: 22309.2 KB/s Software Compression: None Comm Line Compression: 69.7% 3.3:1 Snapshot/VSS: yes Encryption: no Accurate: yes Volume name(s): Vol-0001 Volume Session Id: 4 Volume Session Time: 1529652856 Last Volume Bytes: 3,021,011,807 (3.021 GB) Non-fatal FD errors: 0 SD Errors: 0 FD termination status: OK SD termination status: OK Termination: Backup OK 22-Jun 09:28 centos6-64-dir JobId 4: Begin pruning Jobs older than 6 months . 22-Jun 09:28 centos6-64-dir JobId 4: No Jobs found to prune. 22-Jun 09:28 centos6-64-dir JobId 4: Begin pruning Files. 22-Jun 09:28 centos6-64-dir JobId 4: No Files found to prune. 22-Jun 09:28 centos6-64-dir JobId 4: End auto prune.

As you can see the backup terminated with status "Backup OK" which is exactly what you want for all your backup jobs with Bacula Enterprise. In the joblog above the summary Bacula prints detailed information about what happens on the Client and Storage Daemon with timestamps. In particular you can see the VSS snapshot information with details about all the VSS writers in the above example joblog.

backup virtual machineThe restore of the contained virtual machines works like every other restore in Bacula. From Bweb or bconsole, navigate to the desired job, whether the most recent or a specific point in time. Then select the data that you want to have restored, either everything, a single file, or a specific VM. Finally, initiate the restore either to the original location if the VM has been removed, or perform a cross restore to a different host. Disaster recovery is simplified drastically with the ability to recover entire machines onto different hardware in a new location with the click of a button.

The Bacula configuration examples that we have shared above apply to Hyper-V virtual machine backup. Other hypervisors that we support work in a very similar manner, and each Bacula Enterprise plugin comes with extensive documentation about what resources need to be defined and about what options specific to each hypervisor are available in the FileSet. For instance we chose in the example above to backup all virtual machines on the Hyper-V host, but we could also have selected individual items for backup of virtual machines. If you split the backup job into smaller parts like that, you get a more fine-grained restore experience, your backups will be faster because the jobs are smaller, and you can run several jobs in parallel to speed up the overall process.

Summary on how to backup virtual machine with Bacula

backup virtual machine
Backing up virtual machines through their hypervisor backup interfaces provides many advantages over traditional agent based backups, especially when simplicity of management and disaster recovery are paramount. Bacula Enterprise Edition gives you the ability to choose and combine virtualized and traditional approaches to provide a complete backup and recovery solution for a wide range of virtual environments, databases and applications, and physical hardware.

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>