Do not add fstab entry
2.9 KiB
layout | title | permalink |
---|---|---|
wiki | BackupRestore | /wiki/BackupRestore/ |
Backup, Restore, Migration Tools
Qubes supports easy backups and restores of your VMs, and specifically very easy migration between two systems.
There are currently two command-line tools for this: qvm-backup
and qvm-backup-restore
, both of which are available in Qubes Alpha 2 (qubes-core-dom0 >= 1.1.8). Users of Qubes Alpha 1 can still download the qvm-backup
too here and use it to make a full backup of their system, and later restore it on Qubes Alpha 2, using qvm-backup-restore (the latter is not available on Alpha 1).
Making a full backup of your VMs
- Prepare an encrypted external medium to store the backup
It is strongly recommended to use encrypted media for the backup. qvm-backup
will not encrypt the backup!
Steps to create a fully encrypted LUKS volume on the external USB hard drive /dev/sdb:
WARNING: Everything on your external USB drive will be deleted with this process!
$ sudo wipefs -a /dev/sdb
$ sudo cryptsetup luksFormat /dev/sdb
$ sudo blkid /dev/sdb (this is your device UUID)
$ sudo cryptsetup open --type luks UUID=the-long-UUID-of-your-DEVICE backup
$ sudo mkfs.ext4 -m 0 /dev/mapper/backup
- Mount the encrypted medium on which the backup will be stored
$ sudo mkdir /mnt/backup
$ sudo mount /dev/mapper/backup /mnt/backup
Now anything we store in /mnt/backup is stored on the encrypted LUKS volume of our external USB drive.
- Backup your VMs
$ sudo qvm-backup /mnt/backup
The qvm-backup
tool will take care about backing up the VMs configuration, and all your AppVMs private storages, and, if necessary, will also backup any custom templates or netvms that any of your AppVMs might be using.
- Lock the encrypted volume
$ sudo umount /mnt/backup
$ sudo cryptsetup close backup
Restoring VMs from a backup
- Mount the medium containing your VM backups
(It is advisable to script this to ensure the right UUID is always attached to the right volume)
$ sudo cryptsetup open --type luks UUID=the-long-UUID-of-your-DEVICE backup
$ sudo mount /dev/mapper/backup /mnt/backup
- Restore VMs
$ sudo qvm-backup-restore /mnt/backup/<specific_backup_dir>
The qvm-backup-restore
tool will restore all the VMs (and any backed up custom template VMs), update the Qubes database and add appmenus for the restored VMs. Your existing VMs will not be removed.
If there is a name conflict, i.e. you try restoring a VM with the same name as a VM already on the host, qvm-backup-restore
will refuse to continue and will ask you to remove (or rename) the conflicting VM from the host first.
- Unmount your backup medium
$ sudo umount /mnt/backup
$ sudo cryptsetup close backup