2.10.6.1. Attaching Backups to Linux Virtual Machines

  1. Make sure that Virtuozzo guest tools are installed in the virtual machine the backup will be attached to. In particular, the guest tools provide the prl_backup utility required to attach backups to Linux VMs.
  2. Obtain the ID and file name of the backup to attach. You can do this with the prlctl --backup-list command. For example:

    # prlctl backup-list vm2 -f
    ...
    Backup_ID: {0fcd6696-c9dc-4827-9fbd-6ee3abe017fa}
    ...
    Name: harddisk.hdd.qcow2c
  3. Attach the backup as an HDD to the Linux VM you will access the backup from. You can do this with the prlctl set --backup-add command. For example:

    # prlctl set vm1 --backup-add {0fcd6696-c9dc-4827-9fbd-6ee3abe017fa} \
    --disk harddisk.hdd.qcow2c
    Creating hdd1 (+) sata:2 real='backup:///{0fcd6696-c9dc-4827-9fbd-6ee3abe017fa}/ \
    harddisk.hdd.qcow2c' backup='{0fcd6696-c9dc-4827-9fbd-6ee3abe017fa}' \
    disk='harddisk.hdd.qcow2c'

    If the backup contains multiple disks and you need to connect them all, omit the --disk parameter. . Obtain the name of the newly attached device, which is disabled at the moment, using the prl_backup list command. For example:

    # prlctl exec vm1 prl_backup list
    ...
    List of disabled attached backups:
    [1] /dev/sdc
  4. Enable the backup with the prl_backup enable command. For example:

    # prlctl exec vm1 prl_backup enable /dev/sdc
  5. Optionally, make sure the backup is now enabled, using the prl_backup list -e command. For example:

    # prlctl exec vm1 prl_backup list -e
    List of enabled attached backups:
    [1] /dev/sdc (/dev/mapper/backup1)
    NAME                TYPE  SIZE   FSTYPE   UUID
    MOUNTPOINT
    backup1 (dm-3)      dm    64G
    |-backup1p1 (dm-4)  part  500M   ext4     1ac82165-113d-40ee-8ae2-8a72f62d95bf
    `-backup1p2 (dm-5)  part  63.5G  LVM2_mem Zw9QiY-BiU5-o8dn-ScTK-vOZx-KujW-wbgmS3

Now you can mount the required backup part as a filesystem.

Mounting the ext4 part requires no additional steps. For example:

# prlctl exec vm1 mount /dev/mapper/backup1p1 /mnt/backup1p1

You can now access the backup part contents at /mnt/backup1p1.

Mounting the LVM2_member part requires the following preparations:

  1. Assign the new volume group a new name so it can coexist with other volume groups. You can do this with the vgimportclone command. For example:

    # prlctl exec vm1 vgimportclone -n backup1p2 /dev/mapper/backup1p2
    ...
    Volume group "VolGroup" successfully renamed to "backup1p2"
    ...
    Found volume group "backup1p2" using metadata type lvm2
    ...
  2. Obtain the list of mountable logical volumes with the lvs command. For example:

    # prlctl exec vm1 lvs | grep backup1p2
    lv_home backup1p2 -wi-------11.54g
    lv_root backup1p2 -wi------- 50.00g
    lv_swap backup1p2 -wi-------1.97g
  3. Activate the required logical volume with the lvchange -ay command. For example:

    # prlctl exec vm1 lvchange -ay /dev/backup1p2/lv_root
  4. Mount the logical volume as a filesystem. For example:

    # prlctl exec vm1 mount /dev/backup1p2/lv_root /mnt/backup1p2

You can now access the backup part contents at /mnt/backup1p2.