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