Convert a physical PC into a VirtualBox virtual machine

This seems to be a fairly popular topic out there, so I thought I’d share my little how-to. It’s not really different to other guides you may read, but given Oracle’s inevitable imminent alienation of the VirtualBox community, the inevitable jacking up of the support costs, the inevitable stifling of development resources and feature enhancements followed by the inevitable fork (perhaps with some patent litigation thrown in for good measure), what better time to try it out? :)

 

My test source physical machine is an old Pentium 4 box running Windows XP Home SP3. It contains a single 75GB HDD, itself holding a single partition occupying the whole disc. Nothing fancy. The objective is to convert the machine into a VMware VMDK image file, then import that into VirtualBox (in this case, version 3.1.4 running on an OpenIndiana oi_147 host). According to the VirtualBox user manual, the VMDK format is fully supported by VirtualBox. If you’re trying this out yourself, note that in this guide I’m assuming prior basic familiarity with creating VMs in VirtualBox.

Our first step is to download and install the free VMware vCenter Converter Standalone application on the physical source PC. You can grab it from the following location – but note you will need to create an online account and register to receive a download link (yuck):

http://www.vmware.com/products/converter/

After downloading, simply step through the installation wizard defaults – there are no surprises nor quirks to note.

 

Once installed, let’s run the vCenter Converter application, and convert our machine to a virtual clone:

vCentre - convert a machine...

Yes, we want to use the machine that is powered on and running the vCenter application itself:

vCenter - powered on local machine...

For now I am saving the clone to the HDD of the machine I am cloning from – we are going to resize the clone’s HDD size, so we won’t have any space issues (obviously use a larger physical disc, pop another disc in the machine, or save to large external storage otherwise). Note that we using VMware Workstation 7.0.x file format, and the name of our clone is “cybernoid-virtual”:

vCenter destination settings

In the Options screen that follows, click on the “Data to copy” entry on the left hand side pane, and on the right hand side click on “Advanced…”, where we can get at the disc resize settings:

vCenter advanced options

We have resized the destination (clone) HDD to be 20GBs (with the “type” set to “not pre-allocated”). Also, for the other options available in this screen, we have specified a single CPU, 500MB of RAM, and NAT networking. Make a note of these latter options and their settings, as we’ll need to manually enter them into VirtualBox when recreating the virtual machine there:

vCenter options

That’s all I configured here, leaving everything else at the defaults, and letting the application clone the physical machine (which took about an hour).

 

At the end of the process, vCenter Converter had created a folder containing the critical cybernoid-virtual.vmdk file. I copied this file over to my OpenIndiana machine, fired up VirtualBox 3.1.8, and imported it using the VirtualBox Virtual Media Manager.

I then used the VirtualBox New Virtual Machine Wizard to create a Windows XP virtual machine, pointing to the .vmdk file to use for its virtual hard disc. I was careful to set it to use 500MB of memory, and only a single CPU.

 

Finally firing it up, I was met with a VirtualBox splash screen, followed by a blank, black screen with no other activity. Although the VM reported a status of “Running” it was clearly failing to boot at all. Referring to the VirtualBox Windows migration how-to here…

http://www.virtualbox.org/wiki/Migrate_Windows

…I came across the following section:

“…If you perform a Windows installation with default settings in VirtualBox, Halacpi.dll will be chosen as VirtualBox enables ACPI by default but disables the IO APIC by default. A standard installation on a modern physical PC or VMware will usually result in Halaacpi.dll being chosen as most systems nowadays have an IO APIC and VMware chose to virtualize it by default (VirtualBox disables the IO APIC because it is more expensive to virtualize than a standard PIC). So as a first step, you either have to enable IO APIC support in VirtualBox or replace the HAL. Replacing the HAL can be done by booting the VM from the Windows CD and performing a repair installation…”

Rather than shag around with a repair installation, I simply enabled IO APIC in the VirtualBox settings for the machine, and bingo:

Cloned VM running in VirtualBox

My host machine is an Intel Q8200 which doesn’t have Intel VT-x (thanks so much, Intel…), but even so, performance is pretty good.

 

I also tried the above procedure to create a virtual clone of a laptop running Windows 7 64 bit. It also worked fine, but only after using an IDE storage controller to attach the VMDK to in the VirtualBox settings for the VM – using SATA, the VM would refuse to boot without a BSOD:

VirtualBox storage controller settings

Windows 7 VirtualBox guest

About these ads

21 thoughts on “Convert a physical PC into a VirtualBox virtual machine

  1. Pingback: Creating an iso image of an entire HD including boot info

  2. hoss

    Dave I have used this entry a number of times to convert machines to vbox. It really made a difference – thank you!

    One thing I’ve found in the current version of vbox is that the virtual media manager, as accessed by the file menu, does not offer attaching a .vmdk file. That’s ok, it’s easy to tap the .vmdk inline with the creation of new vm. Maybe that’s what you meant in your posting; but I mention it just in case some other person reads your post and is briefly baffled by that.

    Reply
  3. Medo

    Hi ,, Thank you for your helpful post, I have a question that hope to get answer for.

    i have a machine with WinXP ,,, I am using it to run a small ERP system. recently I started to have a need to use anther Os, so I installed the VMBox and hosted the new OS on it, however it’s slow for both.

    my question is will be better to convert the original physical machine to virtual, and host both virtual on some kind of small VM host ,,, will this free the resources?. and if so what is the recommended host for me.

    Thanks in advance for any answer.

    Reply
  4. Aidan

    Hi

    I’m have a created an image of an old xp machine and its running on a windows seven 64bit os. The problem is finding video drivers for the zip machine and chipset drivers. Any ideas on how I can get the video to work? Everything else is working really well.
    Thanks in advancef

    Reply
    1. davekoelmeyer Post author

      Thanks for commenting :) I’m a little unclear as to your setup here. When you say you’ve got your created Windows XP image running on Windows 7, do you mean successfully running in VirtualBox in Windows 7? If that is the case, then what is the specific problem you are having with the virtual machine or the video functionality with it? I’m also not quite sure why you’d need chipset and “zip machine” drivers for the virtual machine.

      Reply
      1. Aidan

        Hi
        Thanks for getting back so soon. I have recently created an image of an old xp machine running some software that I can’t get my hands on. I bought an acer pc running win 7 64bit and I’ve installed virtual box.I have successfully loaded the xp image in virtual box and everything works great except there is no video driver loaded in the xp virtual machine. When I go into device manger the chipset and video driver are missing. Please advise on what I should do. Thanks

      2. davekoelmeyer Post author

        Ah – sounds like you have yet to install the VirtualBox Guest Additions. On the VirtualBox menu bar for your running Windows XP virtual machine, select “Devices” -> “Install Guest Additions…”. Follow the prompts and accept any driver warnings that may appear. After installing the Guest Additions and rebooting the virtual machine, everything should work.

        There is no need to install device drivers separately – simply ensure you have followed the above step.

        More information on VirtualBox Guest Additions can be found here:

        https://www.virtualbox.org/manual/ch04.html

        Let me know if this helps :)

      3. Aidan

        Hi Dave

        Thanks!! That worked. Chipset driver is installed and the video display is functioning as it should be.
        Thanks again for your help. Top man!

  5. 72pac

    “Rather than shag around with a repair installation, I simply enabled IO APIC in the VirtualBox settings for the machine, and bingo:”

    um, how do you do this in VirtualBox. I cna’t find the setting

    Reply
  6. bb

    This is a nice guide. I have a slightly more complex situation. I use an enterprise laptop running Windows7 and do not have admin access. Would it be feasible to remove the laptop hard drive and connect it another machine running Windows7 in order to create an image?

    Reply
    1. davekoelmeyer Post author

      Thanks for commenting – while I’m sure you’d be able to create an image that way, I can’t see how that would circumvent the requirement to have administrative access.

      Reply
  7. CapainPackers

    Dave your a genius. My biggest struggles were finding the the virtual box file menu. Kind of weird how the Unity desktop separates it from the application window and places the active application menu at the top of the monitor regardless of the window size. Also, with virtualbox 4.2.4, you don’t have to even do the import step. You just copy the vmdk file over and then point to it when setting up the new virtualbox. The last little nugget in your post that I overlooked was the bit about using an IDE controller for a 64 bit Win7 system. I was looking at the IO APIC stuff and saw that it was already on by default. Finally I saw the note about Win7-64. Changed the controller and bingo. I was in business. Now I only have to feed the Windows pig when I absolutely must run a windows only app.

    For anyone else that may be struggling with this, don’t start the windows recovery thingy. I won’t do anything but appear to be running indefinitely. I had to power down to kill it. Just change the controller to IDE.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s