October 13, 2020

Proxmox Backup and Recovery Strategies

An open-source enterprise virtualization platform, Proxmox has its roots in the early part of the 21st century and has undergone extensive development over the years. Proxmox offers a choice of options used to backup virtual machines using the Proxmox Module and in particular the Bacula Enterprise Edition.

Where hosted on a Proxmox hypervisor, the Proxmox Module can be used to provide full backup and recovery for virtual machines including QEMU and LXC guests. Following, we will look at the various features, procedures, and factors that need to be taken into consideration when using the Proxmox Module and the Bacula Enterprise Edition for backup and recovery procedures.

Before we move on, here is a list of the main features of the Proxmox Module:

  • Any guest virtual machine can be backed up as a snapshot, including QEMU and LXC guests
  • Image-level backup can be carried out in full using the Proxmox Module
  • The Proxmox Module can be used to restore the entire virtual machine image
  • Can be used to restore QEMU VM archive (.vma) to an alternative location
  • The LXC archive (.tar) and all configuration can be restored to an alternative directory
  • A Proxmox cluster for each VM can be scanned by the Module, creating a Bacula Enterprise version for each VM.

A quick summary of some of the terms used above may be useful at this point:

  • QEMU is a hypervisor that is used to enable the virtualization of hardware and is open source.
  • LXC allows for the running of several Linux systems using one Linux kernel. It provides OS-level virtualization for Proxmox Module use.
  • Proxmox is the open-source virtual machine enterprise visualization platform.
  • VMID identifies guest VM’s using the Proxmox Module.
  • VMA is the Virtual Machine Archive. The VMA can be used to store QEMU guest VM’s via the Bacula Proxmox Module via the Proxmox hypervisor.

Why the Backup is Needed for Proxmox

Backing up virtual machines is essential. Just as IT departments perform regular backups of physical machines, the same must be done for VM’s. There was a time when this could not be done with Linux. The Proxmox Module overcame that problem and is now the primary module for VM backups.

The method of preference is to use the Bacula Enterprise File Daemon. This is designed to work with each individual VM rather than all at once, and enables the use of the following features within the Bacula Enterprise Proxmox Module:

  • Quick restores of individual files.
  • Checksum of individual files for Virus and Spyware detection.
  • Verify Jobs.
  • File or Directory exclusion (such as swap or temporary files).
  • File-level compression.
  • Accurate backups.

All the above are available when using the Bacula Enterprise File Daemon method of backup.

The alternative backup method is to use the image-level backup. This does not require the File Daemon to be inserted in every VM and is preferred by some users. Here is a brief look at how to perform a single guest VM backup.

How to Backup Proxmox

To perform a Proxmox Backup for a  single guest VM the following steps must be taken:

  • For LXC guest VM’s the configuration needs to be saved
  • The user must then stop the VM and create a new backup snapshot on request
  • Perform the vzdump execution to save the data.

While we mentioned stopping the VM, the backup can be performed while it is running. Note that the Proxmox Module operates automatically in creating a backup snapshot – which will be removed once the backup is complete – and it will not affect any other VM’s, only the one being backed up. The user will be kept up to date with progress via messages such as:

JobId 68: Start Backup JobId 68, Job=proxmox.2018-01-25_11.25.05_21

JobId 68: Using Device “FileChgr1-Dev2” to write.

JobId 68: Volume “Vol-0002” previously written, moving to end of data.

JobId 68: proxmox: Start Backup vm: ubuntu-container (101)

JobId 68: proxmox: Backup of vm: ubuntu-container (101) OK

Any QEMU guest VM will be backed up to a .vma file, while LXC guest VM’s will create a .conf and .tar file. If multiple guest VM’s are backed up simultaneously, files will be created for each. Users can find the appropriate files identified as follows:

/@proxmox/qm//VM.vma  – for QEMU guest VMs

/@proxmox/lxc//VM.conf and /@proxmox/lxc//VM.tar  – for LXC guest VMs

How to Restore Proxmox

The Proxmox Module offers two distinct Restore options: Restore to Proxmox hypervisor and Restore to the local directory.

Restore to Proxmox

With this method, the guest vmid may be restored to the original if not already allocated using the restore where= parameter, otherwise it will be stored as a new guest VM via the Proxmox hypervisor. The Bacula Proxmox Module will give each new guest VM a value of +1 and +11 to reduce the possibility of conflict where two guest VM’s are created simultaneously. Proxmox itself has no resolution to handle this situation, hence the Bacula Proxmox Module operates this mitigation process. Usually, the new VM will be allocated the next available vmid thus keeping allocations to a minimum.

The operator should see progress listed as follows:

JobId 76: Start Restore Job RestoreFiles.2018-01-25_13.50.31_29

JobId 76: Using Device “FileChgr1-Dev1” to read.

JobId 76: Ready to read from volume “Vol-0004” on File device “FileChgr1-Dev1” (/opt/bacula/archive).

JobId 76: proxmox: VM restore: lxc/ubuntu-container/VM101 as VM222

JobId 76: End of Volume “Vol-0004” at addr=47137166325 on device “FileChgr1-Dev1” (/opt/bacula/archive).

Restore to a Local Directory

To restore to a local directory, the user needs to point the data to set a location. Thus, the parameter should read such as restore where=/tmp/bacula/restores. The progress log will read thus:

JobId 90: Start Restore Job RestoreFiles.2018-01-30_15.04.12_05

JobId 90: Using Device “FileChgr1-Dev1” to read.

JobId 90: Forward spacing Volume “Vol-0001” to addr=45406565308

JobId 90: proxmox: VM local restore: qm/ubuntu-server/VM108

The above indicates that the guest VM has been restored to a local directory and identifies where it can be found.

Full details of the backup and restore procedures and more information on the Bacula Proxmox Module can be found at www.baculasystems.com.

About the author 

Peter Hatch

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}