If you are converting an Oracle VirtualBox VDI (Virtual Disk Image) to a VMDK for use with VMware ESXi, you might come across the following error:
Unsupported or invalid disk type 2 for 'scsi0:0'. Ensure that the disk has been imported
The invalid disk type 2 is typically a giveaway that the VMDK was mostly likely converted to a format that is only understood by a VMware Type 2 Hypervisor (Fusion/Workstation/Player) rather than ESXi which is a VMware Type 1 bare-metal Hypervisor.
Luckily, there is a straight forward way to convert the existing VMDK into the format that ESXi understands!
Note: While VirtualBox does offer an export appliance option which produces an OVA (Open Virtualization Archive), it fails to properly import into a VMware environment 🙁 and hence the need to work directly with the VDI images.
Step 1 - Shutdown the VirtualBox VM and open a terminal as we will need to use the vboxmanage CLI
Step 2 - We need to clone each existing VDI image to the initial VMDK format by running the following command:
vboxmanage clonemedium rocky-linux-from-virtualbox.vdi --format=VMDK --variant=ESX rocky-linux-from-virtualbox-original.vmdk
Step 3 - Use either the vSphere Datastore browser or SCP the VMDK(s) to the desintation ESXi host
Step 4 - SSH to the ESXi host and we will use the vmkfstools to convert from the original VMDK format to one that ESXi understands by using the following command:
vmkfstools -i rocky-linux-from-virtualbox-original.vmdk -d thin rocky-linux-from-virtualbox.vmdk
Once the conversion has completed, you should confirm that VM can successfully boot in the next step before deleting the original VMDK(s) as they are no longer needed.
Step 5 - Finally, create the new destination VM in ESXi and attach the newly converted VMDK(s). It is also important before you complete the VM wizard, that you confirm the firmware type that was used whether it is BIOS or EFI and properly configure that under VM Options->Boot Options before creating the VM or it will not boot properly.
Note: You may also need to modify the default storage adapter based on the OS you have installed.
In using the latest VirtualBox 7.0 release to install the latest Rocky Linux distribution, I found that BIOS firmware was default and I simply mirrored that in ESXi VM and successfully allowed me to power on. If you went with the default ESXi VM for Rocky Linux, which is EFI firmware, then you will need to re-create the VM (especially important when using ESXi 8.x due to this VM firmware behavior change) and make sure you detach the VMDK before deleting the VM or you will need to go through the clone and conversion process again.
Thanks for the comment!