Projekt

Allgemein

Profil

VirtualBox40 » Historie » Version 3

Jeremias Keihsler, 12.01.2017 14:35

1 1 Jeremias Keihsler
h1. VirtualBox 4.0 VM disaster recovery
2
3
h1. Backup (export VMs)
4
5
h2. Requirements
6
7
To backup the VMs you will need the following:
8
* @root@ access to the virtualbox-host (SSH or local)
9 2 Jeremias Keihsler
* @vbox_control.sh@ script, which is not part of VirtualBox
10 1 Jeremias Keihsler
11
h2. Preliminary Note
12
13
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.
14
*The virtual machines must be powered off during the backup.*
15
16
h2. Start Export
17
18
The VM-Export process is a three stage process:
19
* show the VMs currently running
20
* read in the VM-names to be saved from config file @/etc/virtualbox/machines_enabled_export@
21
* stop the machines if they are running in the sequence given in the config file
22
* export each VM with current date in the filename into the current workingdirectory
23
* read in the VM-names to be started at boottime from config file @/etc/virtualbox/machines_enabled_start@
24
* start the machines in the sequence given in the config file
25 3 Jeremias Keihsler
26 1 Jeremias Keihsler
<pre><code class="bash">
27
cd ~
28
/usr/local/bin/backup_vm.sh
29
</code></pre>
30
31
the @backup_vm.sh@ is a very simple shell-script doing:
32
<pre>
33
/etc/init.d/vboxcontrol status
34
/etc/init.d/vboxcontrol export
35
/etc/init.d/vboxcontrol start
36
37
exit 0
38
</pre>
39
40
h1. Restore (Import)
41
42
If the virtual machine already exists, we have to delete it first.
43
<pre><code class="bash">
44
VBoxManage unregistervm example_VM --delete
45
</code></pre>
46
The VM-Import process is fairly simple
47
* 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)
48
* import with @VBoxManage@
49 3 Jeremias Keihsler
50 1 Jeremias Keihsler
<pre><code class="bash">
51
cd /mnt/extUSBdrive/VM_Backup
52
VBoxManage import example_VM_110509.ova
53
</code></pre>
54
55
h1. alternative ways of export/import
56
57
give the VirtualBox manual a chance. It can be found at http://download.virtualbox.org/virtualbox/UserManual.pdf