Migrate VirtualBox to VMware ESXi 6.5

There are a lot of tutorials out there but this method worked the best for me to migrate Virtual Machines from VirtualBox to VMware ESXi.

  • Create diskless Virtual Machine in VMware
  • Clone the .vdi Hard Drive from VirtualBox in vmdk format
  • Move the new .vmdk image into VMware datastore using scp or wget
  • Convert using VMware vmkfstools (this option is missing from tutorials!)
  • Attach the Hard Drive and start your Virtual Machine in VMware

I’ve done this migrating machines from VirtualBox 4.3 to VMware 6.5, it should also work with other VirtualBox or VMware versions.

ADVERTISEMENT


Create diskless VM in VMware

Open your VMware and create Virtual Machine with the parameters you want and remove all the Hard Drives. This will create directory in your datastore where we will upload the Hard Drive later on.


Clone the .vdi Hard Drive from VirtualBox in vmdk format

You need to proper shutdown the Virtual Machine in VirtualBox and use VBoxManage to clone the hard drive in vmdk format. This will create new hard drive on which you can work with and you will have the original one just i case something is not working as you expect.

cd /path/to/virtual/machine/
VBoxManage clonehd Windows2008.vdi Windows2008-tmp.vmdk --format vmdk

You will need to have extra space for the cloned images, if you don’t attach some other USB Hard Drive or NFS storage if working in remote data center.

If using phpVirtualBox open File -> Virtual Media Manager, highlight the Drive you want to clone and click Copy

Virtual Media Manager

Copy Virtual Hard Drive

Hard Drive File Type

Storage On Phisycal Hard Drive

New Hard Drive To Create

This will also create a clone of your Hard Drive and you will see the process in the bottom of your phpVirtualBox web interface.


Move the new .vmdk image into VMware datastore using scp

You will need to enable SSH on your VMware machine to be able to use SCP to transfer the cloned image from VirtualBox machine to VMware machine or wget it from VirtualBox machine. In vSpere Web Client click on the server you want to enable SSH and go to Configure -> System -> Security Profile and click Edit

VMware Enable SSH

Login into your VirtualBox machine and SCP the file to your VMware machine

cd /path/to/virtual/machine/
scp Windows2008-tmp.vmdk root@vmware-esxi.yourdomain.com:/vmfs/volumes/volume01/yourmachine

Or wget the cloned Hard Drive from your VirtualBox machine, you need to have your cloned Hard Drive into your phpVirtualBox directory on your VirtualBox machine

cd /vmfs/volumes/volume01/yourmachine
wget http://virtualbox-host-or-ip.yourdmain.com/Windows2008-tmp.vmdk

Convert using VMware vmkfstools

If you don’t do this part you will have your Hard Disk as IDE drive and the performance of your machine will be very slow, there is a Official article how to convert IDE to SCSI but it’s missing the part and if you try to open the .vmdk you will see that you are unable to open very large file (in my case 128GB).

Using vmkfstools to clone the clone you will have 2 files Windows2008.vmdk (meta file that you can open and edit) and Windows2008-flat.vmdk (the actual data file)

To get the desired files use this commands:

cd /vmfs/volumes/volume01/yourmachine
vmkfstools -i Windows2008-tmp.vmdk  -d thin Windows2008.vmdk

Now open the Windows2008.vmdk and change ddb.adapterType = “ide” to ddb.adapterType = “lsilogic” as explained in this VMware Knowledge Base


Attach the Hard Drive and start your Virtual Machine

Now you can attach your existing Hard Drive Windows2008.vmdk and start your Virtual Machine, if everything is OK you can delete the old Windows2008-tmp.vmdk file.


VirtualBoxhttps://www.virtualbox.org/
VMwarehttps://www.vmware.com/