Backup Virtual Machines

Since release 1.5 it is possible to back up and restore Virtual Machines. This feature can be used to recover deleted machines, restore contents after changes and even to migrate machines to another server.

The backup and restore procedures must be used from the command line.

Synopsis

sudo rvd_back --backup machine1
sudo rvd_back --restore /var/lib/libvirt/images/backup/machine1-2022-04-06.tgz

Backup

Perform the backup calling the rvd_back tool with the names of all the virtual machines you want to backup.

sudo rvd_back --backup machine1 machine2 ... machineN

Clones and bases

Only the files and definitions are stored in the backup file. If you want to backup a clone and you want to make sure you can restore it correctly, do a backup of the parent base too.

sudo rvd_back --backup base clone1 clone2 ...

Owner

Information and metadata of the virtual machine is backed up too. If you ever removed the owner but you restore the virtual machine later, the user information such as name and password will be restored too.

Restore

To restore a Virtual Machine you must pass the path of the filename where the compressed backup has been stored.

sudo rvd_back --restore /var/lib/libvirt/images/backup/machine1-2022-04-06.tgz

If Ravada detects this virtual machine is already there it will ask for confirmation. Metadata and user information will be restored along with filesystem contents.

Migration to another server

The backup file can be used to migrate the virtual machine to another Ravada server.

Follow these steps:

  1. Create a new clone

../_images/copy_machine.png
  1. Spinoff the clone

Select the clone you just created in the admin machines page, and in the base tab click on spinoff.

../_images/spinoff_button.jpg
  1. Perform the backup

sudo rvd_back --backup ubuntu-0
  1. Copy the result tgz file to the other server

sudo bash
rsync -avP /var/lib/libvirt/images/backup/ubuntu-0-2022-04-06.tgz frankie@:server_dst:
  1. Restore

sudo rvd_back --restore /home/frankie/ubuntu-0-2022-04-06.tgz

Owner users will be created in the new virtual machine if they don’t exist. The users will be assigned regular user permissions. Specially granted privileges or administration roles must be set up manually after restoring.

Backup directory

The default backup directory will be the folder backup inside the default storage pool. In most systems that will be located at: /var/lib/libvirt/images/backup. You can set another directory from the Node Management menu in the frontend: go to Admin Tools and select Nodes, then in KVM_localhost change the backup directory and save it.

../_images/node_backup_directory.jpg