Previous page

Next page

Locate page in Contents

Print this page

Attaching Backups to Virtual Machines and Containers

To read the contents of a virtual machine or Container backup, you can attach it to a virtual machine or Container as a virtual hard disk.

Notes:

1. Only local backups can be attached.

2. The attached backup is writable so that the filesystem can process its journal on mount. However, all changes will be discarded when the backup is detached. The amount of data that can be written to the attached backup is limited to 256MB.

3. Attached backups are not preserved during clone, backup and snapshot operations.

4. Virtual machines with Windows Server 2003 require SATA drivers for attached SATA virtual disks to work.

Attaching Backups to Linux Virtual Machines

  1. For the backup you need to attach, obtain the backup ID and file name with the prlctl backup-list -f command. For example:

    # prlctl backup-list vm2 -f

    ...

    Backup_ID: {0fcd6696-c9dc-4827-9fbd-6ee3abe017fa}

    ...

    Name: harddisk.hdd.tib

  2. Using the backup ID and file name, attach the required backup as an HDD to the Linux virtual machine 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.tib

    Creating hdd1 (+) sata:2 real='backup:///{0fcd6696-c9dc-4827-9fbd-6ee3abe017fa}/harddisk.hdd.tib' backup='{0fcd6696-c9dc-4827-9fbd-6ee3abe017fa}' disk='harddisk.hdd.tib'

    Note: If the backup contains multiple disks, you can connect them all at once by omitting the --disk parameter.

  3. 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

    Note: Using the prl_backup command requires guest tools.

  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.

Attaching Backups to Windows Virtual Machines

  1. Obtain the backup ID and file name. For example:

    # prlctl backup-list vm2 -f

    ...

    Backup_ID: {cff742a9-f942-41c5-9ac2-ace3b4eba783}

    ...

    Name: harddisk.hdd.tib

  2. Attach the required backup as an HDD to the Windows virtual machine you will access the backup from. For example:

    # prlctl set vm1 --backup-add {cff742a9-f942-41c5-9ac2-ace3b4eba783} --disk harddisk.hdd.tib

    Creating hdd1 (+) sata:2 real='backup:///{cff742a9-f942-41c5-9ac2-ace3b4eba783}/harddisk.hdd.tib' backup='{cff742a9-f942-41c5-9ac2-ace3b4eba783}' disk='harddisk.hdd.tib'

The attached backup will appear as a ready-to-use disk in the Windows virtual machine.

Attaching Backups to Linux Containers

  1. Obtain the backup ID and file name with the prlctl backup-list -f command. For example:

    # prlctl backup-list 102 -f

    ...

    Backup_ID: {d70441dd-f077-44a0-8191-27704d4d8fdb}

    ...

    Name: private.tib

    ...

  2. Using the backup ID and file name, attach the required backup as an HDD to the Linux Container you will access the backup from. You can do this with the prlctl set --backup-add command. For example:

    # prlctl set 101 --backup-add {d70441dd-f077-44a0-8191-27704d4d8fdb} --disk private.tib

    Creating hdd1 (+) sata:0 real='backup:///{d70441dd-f077-44a0-8191-27704d4d8fdb}/private.tib' backup='{d70441dd-f077-44a0-8191-27704d4d8fdb}' disk='private.tib'

  3. Using the backup ID, identify the ploop device corresponding to the backup. For example:

    # ploop list | grep {d70441dd-f077-44a0-8191-27704d4d8fdb}

    ploop28261 /buse/{8417a267-0919-4c8f-a31d-68671358d6a8}_{d70441dd-f077-44a0-8191-27704d4d8fdb}_private.tib/content

  4. Mount the logical volume as a filesystem. For example:

    # prlctl exec 101 mount /dev/ploop28261p1 /mnt/backup1

You can now access the backup contents at /mnt/backup1.