Copying ESXi 6.5 VM to ProxMox 5.2
The steps outlined here were what I needed to do to convert a VMware ESXi 6.5 VM for use in a ProxMox 5.2 host. I wanted to test changing drive sizes and SQL database modifications without messing with a production server.
Preparing the VM on VMWare ESXi
Remove VMWare tools from the VM, through the VM guest OS.
Download and run mergeide.zip from https://pve.proxmox.com/wiki/File:Mergeide.zip
Make sure Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys are in the %SystemRoot%\System32\Drivers folder. If any are missing they can be extracted from %SystemRoot%\Driver Cache\I386\Driver.cab which can be opened in Windows file Exlorer like a directory and then the missing files can be copied out.
Shutdown the VM.
Creating temporary space for the VMDK files on ProxMox host
Because my VM totals about 300GB, I need to allocate enoughspace to store and convert the VMWare VMDK files. My default install of ProxMox left a 98GB ‘Directory’ type storage named ‘local’ (too small for this process) and a 5TB ‘LVM-Thin’ type storage named ‘local-lvm’.
Use lvcreate to create a new logical volume named tmp, 900GB in size, in the pre-existing pve volume group:
lvcreate -n tmp -L 900G pve
Create a file structure on the logical volume:
Add now mount the volume:
mount -t ext4 /dev/pve/tmp /var/lib/tmp
Note: If you wanted to make tmp permanent, run the following:
echo '/dev/pve/tmp /var/lib/tmp ext4 defaults 0 2' >> /etc/fstab
NOTE: I added the above line for a permanent mount, but then removed the logical volume without removing the line from fstab. The result was that ProxMox then booted into Emergency mode until I removed that line).
Create the new VM onProxMox
We need to create a new VM with that has the same number of hard drives as the original VMWare VM, but each should have slightly more space allocated. Our VM started with 3 drives, 20, 165, and 200 GB in size, so we are going to create a ProxMox VM with 21, 166, and 201GB in size.
We opted for similar CPU settings and identical memorysettings for the ProxMox machine as from the VMWare VM. Once the initial VM was created with a 21GBdrive, we went back to the Hardware tab for the ProxMox VM and added the 166GB and 201GB hard drives.
Make note of your new VM’s ID number, it will be needed in the next step. Our example will be 102.
Copy and convert theVMDK files
There were several options available to get the VMDK files. I could use pscp or FTP on my Windows workstation to copy files from the ESXi host to my PC and then again to copy to the ProxMox host. Instead, I opted to use the scp command on the ProxMox host to copy the files directly. Make sure that the VM is powered down and snapshots are consolidated before copying.
scp root@ESX1:/vmfs/volumes/518eblah-a4bablah-blah-69ee0a22blah/Anakin/*-flat.vmdk /var/lib/tmp
Now, with all our VMDK files, we want to convert them into the virtual disks that were created with our new ProxMox VM. If you list the files in /dev/pve, you should see the virtual disk files (again, our demo uses VM ID 102):
Using the qemu-img tool on the ProxMox host, we will convert the VMDK into a raw file format, and store it directly into the virtual disks already created for the ProxMox VM (once for each virtual disk). Note that this can take some time for large virtual disks:
root@lab2:/#qemu-img convert /var/lib/tmp/ANAKIN-flat.vmdk -O raw /dev/pve/vm-102-disk-0
root@lab2:/#qemu-img convert /var/lib/tmp/ANAKIN_1-flat.vmdk -O raw /dev/pve/vm-102-disk-1
root@lab2:/#qemu-img convert /var/lib/tmp/ANAKIN_2-flat.vmdk -O raw /dev/pve/vm-102-disk-2
That’s it. You should now be able to start the VM on the ProxMox host.
Removing Temporary storage
When done, we can remove the temporary storage we created.
Unmount it and then remove it with the following:
Make sure that you remove any entries in etc/fstab if you added them for permanent mounting of the logical volume.