Migrating a physical Windows machine to a VirtualBox VM

Requirement: Given a physical box running Windows (Vista), migrate to a VirtualBox VM on a MacBook Pro.

Comments: I've got a new MacBook arriving next week. It'll have Snow Leopard installed, but will get the Lion upgrade in a short while. Up until now, I've done most of my work on an HP tx2100 tablet running Vista, which has acquired the best part of a hundred applications, some of which are Windows-only. I need to migrate this machine (with 300G of storage in use) into a VM on the new Mac.

Solution: I'm going to migrate the drive with Windows to a virtual drive on the Mac. The drive on the HP is a 320G SATA 2.5". I need to copy this to an image on the Mac. Unfortunately, there isn't an easy way to just move the drive (the MCE optibay would maybe do a job, but it's more dollars and would need to be imported to NZ. So I'm going to use my desktop box running Ubuntu 10 as a staging server, make the virtual drive on that and copy it to the Mac over the network.

1. Prepare Windows to migrate
Following the VirtualBox migration doco, I confirmed that I'm running Halacpi.dll and don't have agp440.sys or intelppm.sys in my device drivers. So I shouldn't need any special actions there.

The doco suggests that, for XP at least, the OS will only have drivers for the disk controller in use and may fail to boot on another (virtual) machine. (This may have been fixed in Vista/7?) I tried the referenced German MergeIDE utility, but it couldn't find a file. So I went to the MS tech note and followed their instructions:

- make a file MergeIDE.reg on a USB key with the text shown in the note.
- validate that Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys were in System32\drivers. They were - if not, I guess you have to find them from someplace.

NOTE: what I didn't do here, but would suggest, is to uninstall all your machine-specific video and platform drivers here and run as much of a "bare" Windows install as you can. See (8) as to why.

2. Move the disk
The disk on the HP is easily accessible (after powering off) under a cover. On removing it, it didn't look like it had a SATA connector.
[image]
That 'connector' is actually an adaptor from SATA to the caddy. Pull it off, and you've got conventional SATA power and data. (This took me some minutes of poring over connector diagrams!)
[image]

So I disconnected the optical drive on my desktop, plugged in the laptop drive, powered up and hit F12 to get into BIOS setup. That showed the drive type configured on the 3rd IDE slave. Booting into Ubuntu showed the drive as /dev/sdc with partitions on /dev/sdc1 and /dev/sdc2.

3. Install VirtualBox on Ubuntu
This was a simple matter of downloading the .DEB installer from the VirtualBox site using wget and running it with:

sudo dpkg --install virtualbox___.deb

(There is an Ubuntu packaged option also - it didn't work).

4. Make a disk image (vdi) file
(This is a more interactive method than in VirtualBox's instructions).
VirtualBox can access 'real' disks that have been defined to it using a .VMDK file. To make this (from drive /dev/sdc as discussed above), enter e.g:

sudo VBoxManage internalcommands createrawvmdk -filename laptop.vmdk -rawdisk /dev/sdc

Note that I'm using /dev/sdc *not* /dev/sdc1. The former is what Windows wants to see in order to boot properly. YMMV if you have an unusual setup like dual boot Windows/Linux.

At this stage you can configure and run a Windows VM off the physical disk. I'd be wary of doing this, as the disk is writable and you might break something so it stops working back in the laptop.

Now we can open VirtualBox media manager (start VirtualBox. I used sudo for this as it needs root to access the physical drive, I think. Then use File / Virtual media manager).

Select the laptop.vmdk file. Select Copy and copy this file to a new VDI file lapall.vdi. This took (300G on a moderately hefty machine) a couple of hours. You obviously need at least 300G of free space on the drive you are copying to.

5. Boot the image
In VirtualBox, do the following:
- use New to add a VM
- enable IO APIC, select a reasonable amount of RAM (1G), single processor, etc.
- in Storage, attach the lapall.vdi file to this machine. Make it the first device to boot off.
- start the VM. Windows should appear, much as on your old computer, only slower. (Unless either your desktop is hugely fast, or your laptop was very slow).

6. copy the image to the target computer
I did this using sftp (Filezilla) - it took about 8 hours (300M disk, 100Mbit connection). I tried briefly running a 1G connection (cable between the two machines) but only got a 2x speedup.

7. Install VirtualBox on the target and boot the image
I did this using the OSX VirtualBox installer (4.1). The image just needs to be dropped in its permanent home and set as a disk.
The basic image then booted fine, albeit with none of the VirtualBox extras such as mouse capture, shared folders, etc.

8. Get VBoxGuestAdditions
This is the set of utilities and device drivers that let VirtualBox coexist with the platform. I had more issues here than at any other stage. Installing the additions resulted in a resource clash with the existing device drivers. I'd suggest removing these at step 1. What I had to do in the end was to delete the drivers (ATI, etc) and revert to base drivers. Then it finally (after much trial and error) would install Guest Additions.