Hi, I want to share with you my struggle with migrating to VirtualBox. I hope it helps someone.
Windows installations are "not happy" when we try to move them from one partition to another. The complete computer change can be a lot more tricky. But it is feasible and I found one just enough easy way to do it that I could remember and then write about.
First, I tried it hard by this guide and failed miserably with 6 hours of wasted time and 3x 100GB of wasted diskspace (using Live CD of Ubuntu and dd-ing 100GB partition). Then I used my usual tool for backup - the great and only Snapshot.exe and the process got a lot more easier.
This guide describes how to move existing active Windows XP to a VirtualBox Machine inside of this active Windows XP, doing so while running the host (to be virtualized) system and without any help from another OS. We will accomplish this just by using second partition or disk with enough free diskspace. We will need roughly 2x the diskspace currently occupied by Windows XP on system drive.
Example of system
- Disk C:\ has a size of 100GB and contains Windows XP system and all system files. It is currently using 30GB and 70GB is free.
- Disk D:\ has a size of 250GB. It is using 180GB and 70GB is free.
We will need around 60GB to execute migration (at least 30GB on Disk D:\ for partition backup) and after successful migration the final footprint will be around 30GB for VDI drive.
What we need
- ISO image or CD with Windows XP Installation (I used Windows XP SP3)
- Installed and running latest release of VirtualBox (I used version 3.0.6)
- One running virtualized Windows XP inside of the VirtualBox with working Bridged network and enabled File Sharing (the size of my clean Windows XP installation was just about 1.5GB)
- CPU with enabled virtualisation extensions (I used AMD Athlon 4850e)
- Software for drive backup and restore - Drive Snapshot
1. Prepare the system
First create clean Virtualized Windows XP environment (if you do not have it prepared already) by creating new Virtual Machine with 256MB RAM, 10GB disk, serving the Windows ISO image to the machine and install windows as usual.
Enable File Sharing on both host and guest systems. Setup VirtualBox network for our Windows XP machine to Bridged network and let the router and DHCP assign an IP address. If you don't have router on your network, use another network type (NAT, ...) or assign IP manually. The goal here is to be able to share files between host and guest systems, so if you can share and copy files between them, it is enough.
2. Prepare host to migration
Use MergeIDE utility or use regedit to manually delete entries from "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices". I deleted only the entry for C drive, but even this is maybe unnecessary.
Close all running applications. This step is not necessary because Drive Snapshot can backup the system drive while you work on it without any problems. But you maybe want your work to be saved on guest system.
3. Backup host system drive
Use Drive Snapshot to create backup of system drive onto the second drive - example: D:\WinXPBackup\drive.sna. Enable sharing of this directory (in our case D:\WinXPBackup).
4. Restore the system drive inside the guest machine
Edit preferences for guest Windows XP machine - add new drive with the same size as the backed partition from step 3. It should create small VDI file for empty virtual disk. Run the clean guest Windows XP. In the guest OS, right-click on This Computer, click on Manage, then in Computer Management choose Storage/Disk Management. Format the new drive, activate it. Wait while format is done. Run Drive Snapshot and restore the backup from step 3 onto the new disk. Point to the shared directory from the host system. This should take a while because the whole backup is (in case of using Bridged Network) copied trought the LAN interface from host to guest. After restore is done, the newly created VDI file is now full of data - another 30GB used. The *.sna backup from Drive Snapshot can be now deleted and I recommend stopping the guest OS and create backup of our VDI file to another location.
5. Creating new guest OS and repairing installation
Now we have VDI file with complete backup of our Windows XP. But it will not work right away, because we changed the hardware almost completely. But first, let's create new Windows XP machine. Select our VDI file as it's only disk. After creation, go to preferences and in system check Enable IO APIC - it has to be enabled to ensure that our virtual system still keeps the same HAL as when installed.
Now to the repair. Let's run the machine.
If you did all OK, it should boot to Windows with no trouble, but that was hardly my case.. When I first booted, I had a little fun first as the boot loader of Windows 7 let me choose to select what to boot (I had Windows 7 installed on different disk when I created the image of my host system). After I chose to boot "previous version" it stopped right at blank screen and freezed
6. So, let's troubleshoot...
I tried to boot from ISO image and repair bootloader in Recovery Console, but Windows Installation didn't recognize any Windows on the disk and thus did not let me choose recovery console.
The second try learned here was succesfull: I ran again the machine with clean Windows XP, logged to Windows and from the Windows ISO image installed the Recovery Console to bootmenu by command: "d:\i386\winnt32.exe /cmdcons". Then rebooted the guest, went to the Recovery Console, selected the "E:\WINDOWS" (our VDI file) from menu of availaible systems and run "fixmbr" and "fixboot e:".
Finally I checked the Enable IO APIC box in System/Motherboard and also Turn on PAE/NX in System/Processor - Extended Featues (don't know if it helps) in preferences of our XP machine and started it. It halted again, but on next restart I had a choice to go to Safe Mode and it worked. Another restart and I was in working environment. The final steps was to install VirtualBox drivers extensions and enable Direct 3D support (enabling in machine preferences and installing extensions drivers again in Safe Mode).
And there you go, finally.. "Yo Dawg, I herd you like Windows XP, so we put yo Windows XP in yo Windows XP, so you can virtualize while you virtualize" (not really possible)