Projekt

Allgemein

Profil

Aktionen

VirtualBox 4.0 VM disaster recovery

Backup (export VMs)

Requirements

To backup the VMs you will need the following:
  • root access to the virtualbox-host (SSH or local)
  • vbox_control.sh script, which is not part of VirtualBox

Preliminary Note

While a virtual machine could be imaged and restored like a phyisical machine using this method has the advantage that all meta-data like memory size, number of processors or MAC-adr of each NIC are saved as well. By restoring the virtual machine to another host you could do a perfect clone of the original machine.
The virtual machines must be powered off during the backup.

Start Export

The VM-Export process is a three stage process:
  • show the VMs currently running
  • read in the VM-names to be saved from config file /etc/virtualbox/machines_enabled_export
  • stop the machines if they are running in the sequence given in the config file
  • export each VM with current date in the filename into the current workingdirectory
  • read in the VM-names to be started at boottime from config file /etc/virtualbox/machines_enabled_start
  • start the machines in the sequence given in the config file
cd ~
/usr/local/bin/backup_vm.sh

the backup_vm.sh is a very simple shell-script doing:

/etc/init.d/vboxcontrol status
/etc/init.d/vboxcontrol export
/etc/init.d/vboxcontrol start

exit 0

Restore (Import)

If the virtual machine already exists, we have to delete it first.
VBoxManage unregistervm example_VM --delete

The VM-Import process is fairly simple
  • goto the folder where your .ova resides (/mnt/extUSBdrive/VM_Backup needs to be replaced with your source-directory, example_VM_110509.ova needs to be replaced with the actual backup of your VM)
  • import with VBoxManage
cd /mnt/extUSBdrive/VM_Backup
VBoxManage import example_VM_110509.ova

alternative ways of export/import

give the VirtualBox manual a chance. It can be found at http://download.virtualbox.org/virtualbox/UserManual.pdf

Von Jeremias Keihsler vor mehr als 7 Jahren aktualisiert · 3 Revisionen