Moving Virtualbox to real hardware

Today, my client gave me the task of moving a virtualbox machine to real hardware.

VBox specs: 2 Gigabyte ram, 1-CPU, 80 Gig harddisk.
Real Hardware: 8 Gigabyte ram, 4-CPU and 1 Terabyte raid5 harddisk.

The reasons to move this host to real hardware are performance issues. The hosting machine is an old linux install which needs to be scrapped because it can’t be updated anymore. This is however impossible as long as it hosts the VBox. To work efficiently, the VBOX guest will simply become the host and not run any vbox’s anymore. The VBox operating system will be Gentoo linux.

To aid myself in the upcoming task (and minimize weekend work time), I created an “At” job. The job will shutdown the VM and make a full harddisk clone offline and then reboot  the VBox. Purpose of this exercise will be to convert the resulting VDI image to Physical Volumes of Linux’s excellent LVM management system.

1) Shutdown the VBox
2) Clone the VDI
3) Start the VBOX
4) Move the VDI to a Raw format using VBoxManage tool
5) Extract the Physical volumes from the virtual disk, using dd.
6) Copy the pv’s to a different host

Now all the preparation is done and we can start the real work, so in the weekend:
7) Shutdown the VBOX
8) Shutdown the Host
9) Boot the machine from a rescue CD with networking
10) Wipe the Harddisk
11) Create partitions of which is at least 1 LVM of sufficient size (100+ gig)
12) Copy the PV’s into the new LVM
13) Create a boot-partition and reinstall the bootsector
14) Reboot and keep the fingers crossed weekend will begin and work end.