Migrating from VMware Server to VirtualBox
Even though VMware Server was working fine with Ubuntu 10.04 (apart from random lockups without a backtrace in sight to debug with), I was kinda unhappy with all the hoops one has to go through just to get a virtual machine going. The kernel modules might break on the next upgrade and are tainting the kernel unnecessarily. Fortunately today we have a few virtualization options to pick from and I chose VirtualBox for this particular setup, as it seemed to be the easiest migration path. Let's begin with installing the prerequisites:
# apt-get install virtualbox-ose virtualbox-ose-dkms qemuThen we had to convert our 2GB-split VMware VMDK files into a single
VMDK
file, otherwise qemu-bin would produce empty raw
files in the 2nd step:# vmware-vdiskmanager -r orig/test.vmdk -t 2 test.vmdk # qemu-img convert -O raw test-flat.vmdk test.raw # VBoxManage convertfromraw test.raw test.vdi Converting from raw image file="test.raw" to file="test.vdi"... Creating dynamic image with size 2147483648 bytes (2048MB)... # ls -lgo *vmdk *raw *vdi -rw------- 1 2147483648 2010-06-05 18:17 test-flat.vmdk -rw-r--r-- 1 2147483648 2010-06-05 18:28 test.raw -rw------- 1 1676681728 2010-06-06 12:50 test.vdi -rw------- 1 432 2010-06-05 18:17 test.vmdkSomehow VBoxManage cannot convert VMDK images directly, hence the
qemu-img
step. All these conversions will take a while, depending on image-size and diskspeed. There's no progress-bar, so just be patient.
With our VDI
image now in place, we can register it to VirtualBox:
# VBoxManage openmedium disk test.vdi # VBoxManage list hdds UUID: ddaaf826-3d25-48d6-9b2a-1afefdd3350f Format: VDI Location: /data/vbox-vm/test/test.vdi Accessible: yes Type: normalNow for the actual virtual machine creation. It's important to create the new machine with the same/similar hardware as the initial VMware instance was configured with, so that the guest OS won't be too suprised about the "new" hardware, i.e. storage- or network-controllers.
# VBoxManage createvm --ostype Debian --register --name "test" \ --basefolder `pwd` # VBoxManage modifyvm test --memory 128 --audio none \ --boot1 disk --clipboard disabled # VBoxManage modifyvm test --pae off --hwvirtex off \ --hwvirtexexcl off --nestedpaging off --vtxvpid off # VBoxManage modifyvm test --nic1 bridged --bridgeadapter1 eth1 \ --nictype1 Am79C970A --macaddress1 000c291ac243I've disabled any kind of hardware virtualization features, as the host-CPU is too old and doesn't support it anyway. Also, I used the MAC address of the VMware VM, so that the guest-OS will (hopefully) receive its known DHCP address. Now for the storage devices. Again, try to use the same controller as configured in the VMware server (see the
.vmx
file of the old VMware instance). Also, we're attaching the virtual harddisk from above to our virtual machine.
# VBoxManage storagectl test --name "SCSI Controller" \ --add scsi --controller LsiLogic # VBoxManage storageattach test --storagectl "SCSI Controller" \ --port 0 --device 0 --type hdd --medium ddaaf826-3d25-48d6-9b2a-1afefdd3350fHaving done that, it should look like this:
# VBoxManage list -l vms | egrep 'Control|MAC' Storage Controller Name (0): SCSI Controller Storage Controller Type (0): LsiLogic Storage Controller Instance Number (0): 0 Storage Controller Max Port Count (0): 16 Storage Controller Port Count (0): 16 SCSI Controller (0, 0): /data/vbox-vm/test/test.vdi (UUID: ddaaf826-3d25-48d6-9b2a-1afefdd3350f) NIC 1: MAC: 000C291AC243, Attachment: Bridged Interface \ 'eth1', Cable connected: on, Trace: off (file: none), \ Type: Am79C970A, Reported speed: 0 MbpsNow our virtual machine should be able to start just fine:
# VBoxHeadless -s testYou probably want to remove the VMware tools from the guest (
vmware-uninstall-tools.pl
) and tweak your startscripts to start your VM during bootup.
Oh, and if the machine just won't start up, we can still cheat and install the VirtualBox GUI:
# apt-get install virtualbox-ose-qt tightvncserver xfonts-base wm2Update: Migrating a WindowsXM VM from VMware to Virtualbox was equally straightforward, but I could not get the NIC type right. Neither
Am79C970A
(PCnet-PCI II) nor Am79C973
(PCnet-FAST III) seemed equal to the VMware Accelerated AMD PCNet
Adapter in VMware. So I had to use the VirtualBox GUI again, as VirtualBox OSE does not ship with RDP support to connect to. Also, the Ubuntu/Lucid version does not ship with VNC support, yet. Here are the commands for the WindowsXP VM again:
# VBoxManage createvm --ostype WindowsXP --register --name winxp --basefolder `pwd` # qemu-img convert -O raw ../../vmware-vm/winxp/winxp-static-flat.vmdk winxp.raw # VBoxManage convertfromraw winxp.raw winxp.vdi # VBoxManage openmedium disk winxp.vdi # VBoxManage modifyvm winxp --memory 256 --audio none --boot1 disk \ --clipboard disabled --pae off --hwvirtex off --hwvirtexexcl off \ --nestedpaging off --vtxvpid off --nic1 bridged \ --bridgeadapter1 eth1 --nictype1 Am79C970A \ --macaddress1 000c11b9c19c # VBoxManage storagectl winxp --name "IDE Controller" --add ide --controller PIIX4 # VBoxManage storageattach winxp --storagectl "IDE Controller" --port 0 --device 0 \ --type hdd --medium a6723e4d-2caa-433d-91ec-f67238ff36a9