Random   •   Archives   •   RSS   •   About   •   Contact

virt-back: restoring from backups

In a perfect world we should create backups but never need them. Although this statement holds truth, creating guest backups provides many more benefits.

The most common reasons system administrators restore from a virt-back guest backup:

  • recovering from data corruption
  • recovering deleted files
  • recovering from a virus infection
  • recovering from a compromised server
  • backing out a failed change
  • rolling back to a previous state
  • testing disaster recovery plans
  • cloning a server
  • building test environments

During this article we will cover how to restore a system from a virt-back guest backup. This article will not cover how to restore a VM host server.

Virt-back guest restore procedure

In this guide our guest mbison has failed with a major corruption and we would like to restore from our backups. We have our running production guest images in /KVMROOT and our virt-back guest backups in /KVMBACK. We will be restoring the backup on the same hypervisor.


  1. Ensure the guest is shut off.
  2. move the bad image file out of the way
  3. untar the virt-back backup into place
  4. power up the guest

Detailed Procedure:

  1. Verify the guest is shut off by running:

    virt-back --info-all
  2. We noticed that mbison was still running so we invoked:

    virt-back --shutdown mbison
  3. Move the corrupted image file out of the way:

    mv /KVMROOT/mbison.img /KVMROOT/mbison.img.NFG
  4. Unzip and unarchive the backup using the following command:

    sudo tar -xzvf /KVMBACK/mbison.tar.gz -C /KVMROOT --strip 1
  5. When the untar completes, start the guest:

    virt-back --create mbison
  6. Connect to the guest over SSH and verify that all required services and applications start. Determine if the restore was successful.

Restore guest backup on new hypervisor:

The details in this section were adapted from a tutorial given by Fabian Rodriguez.

  1. Re-create any bridge network interfaces on new hypervisor (/etc/network/interfaces for Debian)
  2. Adjust mbison.xml if needed (for example if you are changing paths)
sudo mkdir /KVMROOT
sudo tar -xvzf mbison.tar.gz -C /KVMROOT --strip 1
virsh create /KVMROOT/mbison.xml

Note: We use virsh create instead of virt-back create. While both commands start guest DOMs, virsh create will also register the DOM into the hypervisor.

Want comments on your site?

Remarkbox — is a free SaaS comment service which embeds into your pages to keep the conversation in the same place as your contentr. It works everywhere, even static HTML sites like this one!

Remarks: virt-back: restoring from backups

© Russell Ballestrini.