2.6. Managing Virtual Machine and Container Backups¶
In Virtuozzo PowerPanel, you can create, restore, attach or detach, and delete backups of your virtual environments.
To create a backup of one or more VEs, check the boxes of the required VEs and click the New Backup button above the VE list.
To create a backup of a single VE, you can also click the VE area to expand it, then click the New Backup button in the VE area.
To restore or delete a VE backup, expand the VE area, select the backup on the Backups tab in the bottom of the VE area, and click the respective task button: Restore backup or Delete backup.
2.6.1. Attaching VE Backups¶
To attach a VE backup, expand the VE area, select the backup on the Backups tab in the bottom of the VE area, and click Attach backup.
Attached backups need to be mounted inside the VE.
Note
Changes made to a mounted backup will be lost when it is detached.
The steps to mount a backup depend on VE type:
In a container, locate an unmounted, read-only
part
named/dev/ploop...p1
and mount it. For example:# lsblk -pl -o NAME,RO,TYPE,MOUNTPOINT NAME RO TYPE MOUNTPOINT /dev/ploop21323 0 disk /dev/ploop21323p1 0 part / /dev/ploop44663 1 disk /dev/ploop44663p1 1 part
# mount /dev/ploop44663p1 /mnt/ mount: /dev/ploop44663p1 is write-protected, mounting read-only You can now access the backup contents. For example: :: # ls /mnt/ bin boot dev etc fastboot home lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var
In a Windows virtual machine, run
diskmgmt.msc
from the Command Prompt and bring the disk with the backup contents online. It will be assigned a letter and appear in File Explorer.In a Linux virtual machine, first, locate and enable the backup using the
prl_backup
utility supplied by the guest tools. For example:# prl_backup list List of disabled attached backups: [1] /dev/sdb
# prl_backup enable /dev/sdb
# prl_backup list -e List of enabled attached backups: [1] /dev/sdb (/dev/mapper/backup6770749ad8fef) NAME TYPE SIZE FSTYPE UUID backup6770749ad8fef dm 64G ├─backup6770749ad8fefp1 part 500M xfs b39ba0de-faf0-43be-b344-5b6782dc76e4 └─backup6770749ad8fefp2 part 63.5G LVM2_member oaqfeX-eoPK-CGe1-OKje-eFWQ-q4BP-KcJ9oQ
Now you can mount the xfs part with
mount
. For example:# mount -o nouuid /dev/mapper/backup6770749ad8fefp1 /mnt/part1
You can now access this volume’s contents. For example:
# ls -1 /mnt/part1 config-3.10.0-229.el7.x86_64 grub grub2 initramfs-0-rescue-c0b0e6fa5ca24847b977445b4c2fcfaa.img initramfs-3.10.0-229.el7.x86_64.img initramfs-3.10.0-229.el7.x86_64kdump.img initrd-plymouth.img symvers-3.10.0-229.el7.x86_64.gz System.map-3.10.0-229.el7.x86_64 vmlinuz-0-rescue-c0b0e6fa5ca24847b977445b4c2fcfaa vmlinuz-3.10.0-229.el7.x86_64
Next, rename the LVM part to avoid having two volume groups with the same name. For example:
# vgimportclone -n backup_part2 /dev/mapper/backup6770749ad8fefp2 ... Volume group "centos" successfully renamed to "backup_part2" ... Found volume group "backup_part2" using metadata type lvm2 ...
Now find the mountable volumes in the renamed volume group. For example:
# lvscan | grep backup_part2 inactive '/dev/backup_part2/swap' [3.88 GiB] inherit inactive '/dev/backup_part2/home' [19.54 GiB] inherit inactive '/dev/backup_part2/root' [40.03 GiB] inherit
Enable the volumes you need. For example:
# lvchange -ay /dev/backup_part2/home
# lvchange -ay /dev/backup_part2/root
Finally, mount the volumes. For example:
# mount -o nouuid /dev/backup_part2/root /mnt/part2/root/
# mount -o nouuid /dev/backup_part2/home /mnt/part2/home/
You can now access the contents of these volumes as well. For example:
# ls /mnt/part2/root/ bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
# ls /mnt/part2/home myfile1.txt myfile2.txt
2.6.2. Detaching VE Backups¶
To detach a mounted VE backup from a container or a Windows VM, click Detach backup. Before you detach a mounted backup from a Linux VM, however, unmount the disk(s) and disable the backup inside the VM. You may need to do the following:
Unmount the disks. For example:
# umount /mnt/part1 # umount /mnt/part2/home/ # umount /mnt/part2/root/
Disable the volumes. For example:
# lvchange -an /dev/backup_part2/home # lvchange -an /dev/backup_part2/root
Remove the volume group. For example:
# vgremove backup_part2 Do you really want to remove volume group "backup_part2" containing 3 logical volumes? [y/n]: y Logical volume "swap" successfully removed Logical volume "home" successfully removed Logical volume "root" successfully removed Volume group "backup_part2" successfully removed
Disable the backup. For example:
# prl_backup disable /dev/sdb
Now you can detach the backup from the Linux VM by clicking Detach backup.
If you accidentally clicked Detach backup before taking these steps, clean up the Linux VM as follows:
Unmount the unavailable disks. For example:
# umount /mnt/part1 # umount /mnt/part2/home/ # umount /mnt/part2/root/
Remove the leftover LVM devices. For example:
# dmsetup ls --tree backup_part21-home (253:6) └─backup32dfd4032a21dp2 (253:5) └─backup32dfd4032a21d (253:3) └─ (8:16) backup_part21-root (253:7) └─backup32dfd4032a21dp2 (253:5) └─backup32dfd4032a21d (253:3) └─ (8:16) backup32dfd4032a21dp1 (253:4) └─backup32dfd4032a21d (253:3) └─ (8:16) <...>
# dmsetup remove backup_part21-home # dmsetup remove backup_part21-root # dmsetup remove backup32dfd4032a21dp2 # dmsetup remove backup32dfd4032a21dp1 # dmsetup remove backup32dfd4032a21d