Projekt

Allgemein

Profil

VirtualBox40 » Historie » Version 2

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
<pre><code class="bash">
26
cd ~
27
/usr/local/bin/backup_vm.sh
28
</code></pre>
29
30
the @backup_vm.sh@ is a very simple shell-script doing:
31
<pre>
32
/etc/init.d/vboxcontrol status
33
/etc/init.d/vboxcontrol export
34
/etc/init.d/vboxcontrol start
35
36
exit 0
37
</pre>
38
39
h1. Restore (Import)
40
41
If the virtual machine already exists, we have to delete it first.
42
<pre><code class="bash">
43
VBoxManage unregistervm example_VM --delete
44
</code></pre>
45
The VM-Import process is fairly simple
46
* 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)
47
* import with @VBoxManage@
48
<pre><code class="bash">
49
cd /mnt/extUSBdrive/VM_Backup
50
VBoxManage import example_VM_110509.ova
51
</code></pre>
52
53
h1. alternative ways of export/import
54
55
give the VirtualBox manual a chance. It can be found at http://download.virtualbox.org/virtualbox/UserManual.pdf