27 July 2010

Migrate Virtual Machines from VMware to VirtualBox

Even if you can add vmdk file as Hard Disks in the VirtualBox Media Manager, you lost your Virtual Machines.
The way giving the best compatibility to migrate your Virtual Machines from VMware to VirtualBox is to convert them in Open Virtualization Format (.ovf) first.

To do so, VMWare provides an OVF Tool (see User Guide) which is embedded in some recent versions of Workstation and Player.
If you don't have such version, download the OVF Tool version corresponding to your host.

For better compatibility, according to the guest OS there is some instructions to perform first (you may get more information reading this forum or this article) like:
 - uninstall vmware-tools
 - remove hardware like sound card(s), floppy drive(s), CD/DVD drive(s) (at least unmount iso file), additional IDE controller(s)

Just before converting, you should (otherwise you may get a generic error "Failed to open disk"):
 - prepare a destination folder with enough free space
 - ensure having rights to read source Virtual Machines, and to write in the destination folder
 - switch off Virtual Machine to convert
 - ensure there is no lock file/directory in the Virtual Machine directory (with .lck extension); otherwise restart it with VMware and stop it properly (at worst, delete the .lck file/directory)

Then, you can convert your Virtual Machine to Open Virtualization Format:
ovftool /path/to/VMware/VM.vmx /path/to/VM.ovf

Finally, you can import this "new" Virtual Machine in VirtualBox:
 - check first you have configured the storage of Hard Disk Drives and Virtual Machines (see preferences) to ensure having enough free space (by default, they are stored under your home directory).
 - configure the Virtual Machine: name, operating system, architecture, network mode; and finally add every hardware you need.
 - start the Virtual Machine under VirtualBox to ensure it works perfectly.

If it is the case, you can delete the VMWare version and Open Virtualization Format version which are no more needed.

4 comments:

  1. Bertrand,

    If you don't mind to recreate your VM's settings, then there is a simpler & faster method:
    - copy your main VMDK file on the VBox machine, under /home/vbox/.VirtualBox/HardDisks (eg. "GNU Linux Debian Etch.vmdk"),
    - along with other disk parts if it was split (eg. "GNU Linux Debian Etch-f001.vmdk", "GNU Linux Debian Etch-f002.vmdk", ...),
    - OTOH you can forget those temporary of which names include a 6 digits number in the middle (eg. "GNU Linux Debian Etch-000002-s001.vmdk",
    - then go to VBox Virtual Media Manager (VMM), and add the main one only,
    - then create a new VM from within VBox,
    - at the time of creating a disk, choose an existing one, and select the VMDK you just added to the VMM,
    - now start the VM and voilĂ  ;-)

    HTH

    ReplyDelete
  2. Well... sounds that my previous comment was posted too quickly :-/
    Though it appeared to work with some Linux VMs, my Windows VMs are not restored in their proper state using this method. Sounds that supposedly temporary disk parts hold actual content, though they seem to be ignored by VBOx. Tried different tricks, without success.
    Maybe you should remove my both comments, as this method is not fully reliable.

    ReplyDelete
  3. It is interesting to know it works with VM having only one vmdk file; and maybe with GNU/Linux VMs (to be confirmed by other users).

    For Windows VMs, it is interesting to keep these information to show it had been attempted and had failed.

    Among your attempted tricks, did you try removing as much hardware as you can ?
    May be the Windows meta-data on the disk (registery, device "map" ...) would be lighter and your operation may be successful ?

    ReplyDelete
  4. Useful information. Fortunate me I discovered your website accidentally, and I'm stunned why this accident didn't came about earlier! I bookmarked it.
    My webpage > best vessel monitoring sytem

    ReplyDelete

Thank you for your visit, let's share your point of view: