Migrate/Convert VMWare vmdk (linux guest) to VirtualBox 2.x

Virtual Machines Add comments

In this blog post I’m going to explain how I successfully migrated a linux guest from VMWare to VirtualBox.  For the record I’m running Windows Vista host but I don’t think that should be an issue.  For people migrating a Windows guest there is a helpful page at the virtualbox site, however I couldn’t find any clear guide for people migrating a linux guest.

First things first, make a copy of the VMWare vmdk file (the virtual hard disk) to the folder where your other VirtualBox disks (vdi files) are stored.  The good news is that the current version of VirtualBox can now use a vmdk virtual disk directly – so no need to deal with conversion.

Next, create a new virtual machine within VirtualBox with similar specifications to what you used in VMWare.  When you are prompted to choose a virtual disk, choose the vmdk you previously copied.  Now you can try starting the machine and hopefully the linux OS will boot up, although it may encounter some problems during the boot process.  I migrated a Kubuntu install and in my situation KDE could not start so I was left with a simple command prompt.

At this point we can remove the VMWare tools.  To do this run the “vmware-uninstall-tools.pl” script.  If you installed the VMWare tools from an rpm package, you will need to remove them that way (i.e. rpm -e VMwareTools)

Now we are ready to install the VirtualBox guest additions.  For some, this may be all you need to do to be up and running on your system under VirtualBox.  In my situation, KDE was not starting due to an incorrect X configuration (/etc/X11/xorg.conf).  To fix this I ran “dpkg -reconfigure xserver-xorg” to reconfigure the xorg.conf file.  During this process it setup the video device driver, monitor, keyboard, mouse, etc.  Sometimes it automatically detected the settings, other times I had to select them myself (choosing the obvious choice – i.e. for video driver I selected “vboxvideo” or something similar to that).

After that was finished I restarted the system and KDE started up like normal.  The VirtualBox guest additions weren’t enabled, so I ran the installation one more time from KDE.  After rebooting one final time, KDE was running fine with the guest additions.

This is everything I have done with my migrated system at this point, and I’m not sure how well a vmdk disk does with VirtualBox (performance wise).  If it has performance problems it may be necessary to backup the relevant data and start on a fresh install in VirtualBox.  Only time will tell I guess.

9 Responses to “Migrate/Convert VMWare vmdk (linux guest) to VirtualBox 2.x”

  1. gluni Says:

    sounds all easy, however in my case i had kernel panics: unable to mount (or find) root fs. i tried with several linux guests (debian, opensuse, fedora, slackware). all the same. am i mising something?

  2. phil Says:

    Are you saying that the VM loads fine in VMWare (and was created with VMWare), and now when you try it in VirtualBox 2 it gets the kernel panic? I wonder if there is a version requirement with VMs created in VMWare (i.e. really old VMs will not work). What version of VMWare are you using? From what I have read on the VirtualBox forums, VirtualBox can read the VMWare vmdk file just fine, and in my case that was true. I just had to remove the VMWare Tools installation.

  3. gluni Says:

    The VMware appliances i have been trying where downloaded from the various sites that offer prefabricated appliances; i read in various blogs and forums that there are indeed a couple of restrictions like snapshots, persistent and maybe even SCSI. i found it all not very well documented. i might just have to wait and see…

  4. phil Says:

    I think I understand now. If you want to use those “appliances” then you may need to use the free VMWare Player which you can download from their site.

    Otherwise there are similar sites for VirtualBox images that have already been setup. One site that I have looked at before is http://virtualboximages.com/

    Hope that helps.

  5. gluni Says:

    thx for the link. A parallel installation of VMware Player and Vbox seems to be the easy way to go.

  6. VMware Server 1.7 x Suse 11.0 x64 - Under-Linux.org F?runs Says:

    […] boas as informa??es: virtualbox.org :: View topic – Migration of Wmware Windows XP with SCSI disks Migrate/Convert VMWare vmdk (linux guest) to VirtualBox 2.x | Tech Blog Mas uma busca no google pode te ajudar tb Abra?os __________________ Linux User: #241330 […]

  7. ministry Says:

    Had the same problem like gluni with some vm’s today.
    I had to switch all sdx devices to hdx/uuid (menu.lst, fstab, device.map) and reinstall grub.
    Do not know, why VirtualBox did not accept sda. HD-Setup was with Lsi-Logic adapter.

    Hope this helps someone.

  8. Yves Says:

    As explained above by ministry,
    the major trouble migrating guest machine from VMware to VirtualBox is type
    of DISK controler.
    By default VMware provide in his virtual machine a SCSI disk controler,
    even if you could in VMware choose an IDE controler, it is not recommended
    for performance reason. This choice is done at creation time,
    and this determine the kernel OS contoler installed when you install Windows
    or Linux.
    If with the same disk image, you change from a SCSI disk to an IDE controler
    in a new virtual machine, you have all the chance to get a kernel Panic under linux, or Windows (Blue Screen Of the Death) , when the OS kernel tries to access the disk with the installed driver or modules, rather than using the basic I/O
    offered by the BIOS, as at boot time.
    So in our Linux situation, this require after installing the VMware disk with
    SCSI Lsi-Logic controler, to VirtualBox with IDE or better Serial ATA controler
    to rebuilt at least the initrd associated to the given vmlinuz in /boot.
    This initrd contains a given SCSI kernel module, or an IDE , USB, SATA module plus SCSI emulation modules, depending on what was the “Virtual” hardware at installation time of this OS.

    In modern Linux , from 2 or 3 years now, UUID (associated to the File Sytem done in a given partition or Logical Voume) is used to avoid problem, when you are
    moving file system from a partition to an other, after a restauration for exemple.
    So normally (as exemple in Fedora from Fedora 10 and newer now) you have not to take care aboot UUID in /etc/fstab found in the File system of your VirtualDisk (at lest in the present case:migration from VMware to VirtualBox), or in
    /boot/grub/menu.lst (grub.conf).
    Designating disk as sda, is not a VirtualBox feature, this is an OS feature.
    Since years now, default behaviour of kernel in Fedora, is to manage all disk
    with SCSI driver for “True” SCSI disk like in VMware virtual machine with LSI-Logic controler,
    or SCSI disk emulation for all others: IDE, SATA, USB
    So a single disk in a Fedora environment will allways be acessed vi /dev/sda

    Now the task to perform after having installed your previous VMware SCSI disk
    as a new VirtualBox disk with an IDE, or better SATA controler :
    1) first boot this Linux machine in rescue mode with the DVD or 1rst CD you have
    used to install this guest Linux System
    ( I will provide here only precise command for RedHat,Centos or Fedora OS)
    During this phase, the rescue system will load DISK kernel module corresponding to the emulated hardware of your guest VirtualBox (IDE or SATA and SCSI emulation) and search installed RedHat/CentOS/Fedora system on your disk, and suggest you to mount them on /mnt/system automatically: accept this default behaviour

    2) Now under the maintenance shell
    as suggested some screen before, perform a chroot
    # chroot /mnt/system
    Normally under this chrooted shell, the command: df -k
    should list the mounted File System as if you would have booted normally on yourdisk.
    It’s time to rebuild the initrd with mkinitrd (RedHat,CentOS, Fedora = 12)

    3) To do that:
    => go under /boot:
    # cd /boot
    and list files with:
    # ls -1 vmlinuz* init*
    initramfs-2.6.31.6-166.fc12.x86_64.img
    initrd-2.6.30.9-96.fc11.x86_64.img
    vmlinuz-2.6.30.9-96.fc11.x86_64
    vmlinuz-2.6.31.6-166.fc12.x86_64

    4) manage to repair the most recent kernel, in order to boot normally your disk
    (after you could perform if you wish, the same procedure to the oter kernel)

    5) example for initrd:
    with the example above:
    # rm initrd-2.6.30.9-96.fc11.x86_64.img
    # mkinitrd /boot/initrd-2.6.30.9-96.fc11.x86_64.img 2.6.31.6-166.fc12.x86_64
    (the second parameter is the corresponding vmlinuz kernel)

    6) example for dracut:
    # dracut -f /boot/initramfs-2.6.31.6-166.fc12.x86_64.img 2.6.31.6-166.fc12.x86_64
    (dracut –help will give you extra information)

    7) re-install grubloader
    # grub-install /dev/sda

    8) exit
    (twice: 1 to exit from chroot, 2 to exit from maintenance shell and reboot)
    NOTE
    ‘#’ above is not part of command, but just represents root shell prompt
    ~
    ~

  9. virtualdisk Says:

    […] … 7) Add a new VirtualDisk (40 GB). 8 ) Boot with Knoppix. 9) Copy all content of /dev/sda …Migrate/Convert VMWare vmdk (linux guest) to VirtualBox 2.x …In this blog post I’m going to explain how I successfully migrated a linux guest from VMWare to […]

Leave a Reply

© Phillip Hansen | Original theme by N.Design Studio
Entries RSS Comments RSS Log in