As I wrote in my recent Projects for 2018 blog post, one of the things I wanted to do this year was to setup a VMware ESXi host once again. I have been using VMware Fusion and Workstation so much in the last few months that it would only make sense to also have a server to upload and download VMs to and from. So I did configure the host and I immediately started uploading all the VMs I had on my desktop machines.
All of them uploaded successfully, but one behaved strangely: in VMware Fusion, I would right-click on it, select Upload to Server…, choose my ESXi host and datastore and then select Upload, but the upload process completed immediately, in something like one second. This was very weird because this VM was 15 GBs in size so that was no way the upload had completed already.
However, what was even stranger was that the ESXi host showed the machine correctly uploaded to the host datastore, with configuration files and virtual hard drives. However, attempting to boot the VM would result in a network boot taking place, quickly followed by an Operating System not found error right afterwards, so the virtual machine would consistently fail to boot. This made me realize that there was definitely an issue with my virtual hard disk.
Sometimes, you will have to convert your virtual hard disk files so that other VMware products will be able to handle them correctly, and this is one of those cases.
Luckily, there is a CLI command in VMware Fusion on Mac (I was using version 8.5.10 Pro) that allows you to do just that:
- Open Terminal
- Execute this command after replacing source.vdmk with the virtual hard drive that is not working and dest.vmdk with the location you want the converted drive file to be saved:
/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -r source.vmdk -t 4 dest.vmdk
- This will create two different destination files, one named dest.vdmk and one named dest-flat.vmdk. This is normal.
- Login to your vSphere host and navigate to the datastore where you want your VM to reside
- Upload both dest.vmdk and dest-flat.vmdk to your datastore
- After the upload of both file completes, you will only see one file named dest.vdmk. Once again, this is normal.
- Now you can go ahead and create a new virtual machine and configure it as you please. When you are doing this, make sure to remove the default hard drive and add your converted .vmdk file instead by clicking on Add hard disk > Existing hard disk, navigating to your uploaded virtual drive and attaching that to your virtual machine.
- Create the virtual machine and boot it.
Now your VM should recognize your boot hard drive and should boot directly into your operating system without errors.
When you upload a virtual machine from VMware Fusion (in this case) to your vSphere/ESXi host, things should normally work without issues, but sometimes your uploaded VM could fail to start on your host (even though ti continues working as expected inside VMware Fusion).
When this happens, you might have to convert your virtual hard disk files using the VMware Fusion CLI via Terminal, upload the converted .vmdk files to the datastore on your host, and then attach this converted drive when you create a new VM so it can boot correctly.