TechBookReport logo

VirtualBox - Physical to logical migration

By Pan Pantziarka

While some of the other virtualisation platforms offer tools to convert physical machines to virtual, Oracle's VirtualBox only offers some hints on how to do this manually by making changes to the installed operating system and then ripping out the hard-disk containing the bootable partition and imaging it. Not especially friendly and more likely to put the casual user off than anything else. What follows then is a quick and dirty method that uses a range of tools and which depends, crucially, on using software supplied by market-leader VMware.

For personal use VirtualBox is an attractive option, as detailed in an early review of the product on this site. In particular it offers a relatively light-weight interface and few system-wide changes compared to installing VMware Workstation or VMware Player.

The starting point for this tutorial is a simple scenario: we have a desktop running Windows 2000 and we want to virtualise it so that it can be hosted on another machine running XP or Vista. The new host machine will not have VMware Workstation or Player installed, only VirtualBox.

Now, while VirtualBox creates VDI images by default, we're going to use the fact that it also supports the VMDK format, supported by VMware. We are, therefore, going to start the process by creating a VMware image of the machine we want to transfer to VirtualBox. To do this you need to install VMware vCenter Converter, which you can download for free from the VMware site. The software can be run from inside the machine to be virtualised, which is the option we used. The process is fairly straightforward — basically you pick a partition and a target drive for the VMDK file and off you go. It's not a fast process, so it makes sense to have a bit of a disk cleanup first, and to only virtualise the boot partition (assuming other partitions are used mainly for data and not system files).

One of the things to be aware of is that by default the tool will create multiple VMDK files, which together represent the whole partition — this is for ease of backing up and moving files around — but don't go for the default. Things are more straightforward if you opt for a single big VMDK file. If you do happen to create multiple VMDK files then fear not — you can stitch them all together again using the command-line vmware-vdiskmanager tool from VMware (though you'll need access to machine with VMware on it).

Having already created our VMware format virtual machine, the next step is to copy it to our new host machine. You should also transfer the VMX file, which is VMware's configuration file. We're going to need this shortly. This process takes some time and the VMDK file is likely to be several GBs in size. Copy these VMware files to wherever you want to store them on the host machine.

Once that is done open the VMX file using a friendly editor like jEdit. This contains the details that we are going to have to match for the new VirtualBox machine. Open VirtualBox, select the new machine and then click on settings. You'll want to make sure that key components are matched — for example, number of CPUs, memory, hard disk controller etc. Getting these wrong will mean that your new machine may not boot correctly. Note in particular the number of CPUs and the disk configuration that VMware set up — you'll need to replicate these settings in VirtualBox.

Now we're in a position to fire up VirtualBox. Start the New Virtual Machine Wizard. Select the operating system of the guest image, give the new machine a name, select an appropriate amount of RAM and then, when you get to the Virtual Hard disk stage select the 'use existing hard disk' option and point to the VMDK that you've copied. At this stage DO NOT fire up the new virtual machine. Finish the process by hitting the Create button but don't start the machine. Instead select the Settings icon for the new machine and now we can tweak the virtual settings to match what VMware has done.

First click on the System section and make sure that the number of CPUs is correct. If you have more than one CPU you will need to select the VT-x/AMD-v option on the Acceleration tab. You may need to tweak the host machine's BIOS to ensure that these settings are supported (most BIOSes will either include these settings as part of the CPU section or under a separate virtualisation section). Also important is to ensure that the Storage settings are correct. Although the original physical machine may have had an IDE/ATA or SATA disk controller, it's possible that VMware has mapped this to a virtual SCSI controller. If that's the case then you need to click on the Storage settings, right click on the Storage Tree section and add a SCSI controller. Once done you need to Remove Attachment of the VMDK image from the default IDE controller and then Attach it to the newly created SCSI controller.

Other settings to look for are Display and Network, though they can be tweaked later. With the System and Storage settings correct it's now the moment of truth.

Click on the big green start arrow to boot up your old machine. Once it's up and running you should install the VirtualBox add-ons, and take the time to uninstall the vmware-converter as will. It may be that you'll need to tweak the settings of the machine a few times to handle issues like USB controller problems, but these can all be done using the VirtualBox user interface rather than hacking around any config files. You can also delete the VMX once it's all working.

While this is a fiddly task, it does work and most of the time is taken up with the initial virtualisation into a VMware image and then the copying of files into the new home. The amount of change required in the original machine is really minimal.

PS. In the case of our example, there was a problem that installing the VirtualBox additions — which really is essential — meant that the Windows 2000 guest wound not cleanly exit. Shutting down the W2K host left the VirtualBox container still opening and requiring that it be manually shut down. The fix was to install an older version of the guest additions — in this case version 3.2.8 worked properly. Older versions of the VBox additions ISO can be found by navigating to the appropriate folder here:

Contents copyright of Pan Pantziarka © 2011. If you like it link it, don't lift it. No copying for commercial use allowed. Site © 2011.