How to Backup Virtual Machine with Bacula Enterprise Edition?
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:
- The hypervisor is a convenient central place to orchestrate all backup operations for your virtual environment.
- There is no need to install the Bacula client component (FileDaemon) on each virtual machine individually.
- New clients are automatically detected and added to the backup, reducing the risk of a machine being 'missed'.
- 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:
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
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:
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.
The 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
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.