SysAdmin

How to migrate a KVM / Virtualbox VM to VMware

JJ
Jobin Joseph · Founder and CEO
·Published 27 October 2018·2 min read

Today, we had to migrate a virtialbox VM to VMware, and i had to deal with a lot of issues. Hence i thought about documenting it here since it may help someone.

Convert QCOW2 to VMDK

If you are migrating from a KVM, use the below additional steps to convert the Disk to vmdk and load the VM to VirtualBox.

We have used the below command to convert the qcow2 image to vmdk.

qemu-img convert -f qcow2 myvm.qcow2 -O vmdk myvm.vmdk

Then  created a new VM on the VirtualBox and used this Disk instead of a new one.

Convert the VirtualBox VM to OVF

Once the VM is available on VirtualBox, ran the below command to export the VM to OVF. You can also use the VirtualBox “Export Appliance” if you prefer to.

VBoxManage export centos-import -o jmyvm.ova

Convert the OVA to OVF

For this, you have to use the ovftool which is freely available from VMWware, but you just need to signup there with your email address.
Download Link : https://www.vmware.com/support/developer/ovf/

Once it is installed, We have used the below command to convert the ova to ovf

ovftool --lax myvm.ova myvm.ovf

Prepare the OVF file for VMware import.

rm myvm.mf

Modifications to the myvm.ovf file

Change the VirtualSystemType to vmx-07.

From:

<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>

To:
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>

Change the SATA controller to a SCSI controller.

Below change should be done to avoid getting the below error
“The specified operating system identifier ‘RedHat_64’ (id: 80) is not supported on the selected host. It will be mapped to the following OS identifier: ‘Other (32-bit)’.”

From

    <OperatingSystemSection ovf:id="80">
      <Info>The kind of installed guest operating system</Info>
      <Description>RedHat_64</Description>
      <vbox:OSType ovf:required="false">RedHat_64</vbox:OSType>
    </OperatingSystemSection>

To
<OperatingSystemSection ovf:id="107">
      <Info>The kind of installed guest operating system</Info>
      <Description>centos64Guest</Description>
      <vbox:OSType ovf:required="false">centos64Guest</vbox:OSType>
</OperatingSystemSection>

Remove the “Sound Card” section to avoid getting the below error message later.

Line 83: OVF hardware element ‘ResourceType’ with instance ID ‘7’: No support for the virtual hardware device type ’35’.

    <Item>
        <rasd:AddressOnParent>3</rasd:AddressOnParent>
        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
        <rasd:Caption>sound</rasd:Caption>
        <rasd:Description>Sound Card</rasd:Description>
        <rasd:ElementName>sound</rasd:ElementName>
        <rasd:InstanceID>6</rasd:InstanceID>
        <rasd:ResourceSubType>ensoniq1371</rasd:ResourceSubType>
        <rasd:ResourceType>35</rasd:ResourceType>
    </Item>

Upload the OVF to the ESXi

We have used the below command to upload the OVF to the ESXi Server.
192.168.10.25 is the IP of my ESXi Server
ovftool --net:"NAT=VM Network" -ds=datastore1 myvm.ovf vi://root@192.168.10.25
Opening OVF source: jenkins-hq.ovf
Enter login information for target vi://192.168.10.25/
Username: root
Password: ********************
Opening VI target: vi://root@192.168.10.25:443/
Deploying to VI: vi://root@192.168.10.25:443/
Disk progress: 13%

Once the process is completed, You will be able to start the VM from the ESXi server.

Jobin Joseph
Jobin Joseph, Founder and CEO
5x AWS Certified, ISO 27001:2022 Lead Implementer, 17+ years building cloud infrastructure for regulated industries.
About Jobin →

Reading this because your AWS bill or uptime is a problem?

30 minutes, direct with the founder, no sales pitch: one specific recommendation for your AWS workload.

Book a free 30-minute review
30 min Free Consultation →