To perform disaster recovery of a virtual machine (VM), you can restore it from a backup by defining a new VM from a saved XML configuration and disk images.
Procedure
-
Inspect the backup XML configuration of the VM for the specific storage settings.
# cat </path/to/backup.xml>
Example output section:
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' discard='unmap'/>
<source file='/var/lib/libvirt/images/vm-name.qcow2' index='3'/>
-
Move the backup disks to the locations specified in the backup XML and ensure that their names correspond with the values in the XML.
-
Define a new VM based on the backup XML.
# virsh define --file </path/to/backup.xml>
-
Optional: Modify the XML configuration of the newly created VM to adjust for settings that might be different from the original host, such as the network.
Results
- Start the VM and check that the guest operating system has been recovered correctly.