Title: Restore a Virtual Machine
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

In order to restore a virtual machine, it is necessary to have a backup of all the virtual media and a list of hardware, such as the network adapter, MAC address, number of CPUs, amount of RAM, etc.

To backup an existing guest, start by shutting down guest.  Run "virsh list --all" to ensure you have the right name for the guest, then run "virsh dumpxml guest | tee guest.xml | more " to see its configuration.  Search for the "file=" for a list of all the virtual media.  Make a backup copy of each file.  The guest may be restarted.

To restore this guest on the same host, simply shut down the guest, copy the backup copies of the media over the existing files, then restart the guest.  This is the equivalent of a bare metal restore.

To restore this guest on a different host, it will be necessary to copy the media files to the new host.  After this is completed, create a new virtual machine which uses the newly copied media files.  Be sure to consider the network options including the MAC address.  If you want to permanently move the guest to the new host, be sure the former guest is shut down and use the same MAC address on the new host.  Otherwise do not select a MAC address or manually assign a new one when creating the new virtual machine.

It is also possible to import a virtual machine which has been created on another virtualization platform, such as VMWare or VirtualBox.  Start by copying the virtual media files (typically .vmdk, .vdi or .img files) to the host.  Check the cpu, memory and network settings, then create a new virtual machine using these settings.  There will be no need to install an OS, since one is already including within the virtual media.