Technology & Life

Summary
Notes on migrating virtual machines from ESXi to Proxmox
Published
Reading time
6 min
Tags
,

These are some notes I took while migrating my ESXi VMs over to Proxmox. This was mostly initiated by the Broadcom acquisition, but now that I've used Proxmox, I wouldn't go back to ESXi even if it became homelab-friendly again.

You need a special FUSE filesystem driver to access the ESXi formatted partition.

wget http://ftp.us.debian.org/debian/pool/main/v/vmfs6-tools/vmfs6-tools_0.1.0-3_amd64.deb
dpkg -i vmfs6-tools_0.1.0-3_amd64.deb

Then you can mount it. Use lsblk to view the attached disks.

vmfs6-fuse /dev/sda1 /mnt/esxi

I received this warning upon re-mounting the volume weeks later, but it doesn't seem to have affected my access:

root@proxmox:~# vmfs6-fuse /dev/sdd1 /mnt/esxi
VMFS version: 6
VMFS: Warning: Lun ID mismatch on /dev/sdd1

First, create a new VM in Proxmox. This must happen first as we need the VM ID to migrate the ESXi disk to.

Navigate to the mounted ESXi datastore.

cd /mnt/esxi/...
qm disk import 102 DiskToMigrate.vmdk vmstore

In this case, 102 is the target VM ID and vmstore is the name of the datastore in PVE.

Note: Specify the VMDK image descriptor file (.vmdk), not the "flat" file (-flat.vmdk). Example:

-rw------- 1 root root 20G Jul 16 10:54 'My VM-flat.vmdk'
-rw------- 1 root root 462 Jul 16 09:15 'My VM_1.vmdk'

If one uses the flat instead of the descriptor:

qemu-img: Could not open 'My VM_1-flat.vmdk': invalid VMDK image descriptor
copy failed: command '/usr/bin/qemu-img convert -p -n -f vmdk -O raw 'My VM_1-flat.vmdk' zeroinit:/mnt/pve/vmstore/images/110/vm-110-disk-1.raw' failed: exit code 1

Here's how to convert to qcow2:

qemu-img convert -f raw -O qcow2 vm-102-disk-0.raw vm-102-disk-0.qcow2

You can optionally compress the image with -c. Applies zlib compression to the disk image. Loses the ability to use snapshots. Recommended only for slow, mostly-read type disks. Requires decompression/compression during access.

qemu-img convert -f raw -O qcow2 -c vm-102-disk-0.raw vm-102-disk-0.qcow2

Beware: there's no progress bar, try using time.

Lastly, attach the disk image to the VM:

qm set 102 --virtio0 vmstore:102/vm-102-disk-0.qcow2

Or use --scsi0 or --sata0 or --ide0, etc.

Note: Do not use the qm disk import syntax here -- that is for importing foreign disks into Proxmox.

Important: Ensure booting from the disk is enabled and set the correct boot order in VM > Options > Boot order.

To passthrough a physical disk, e.g. a SATA SSD acting a NAS disk:

qm set 100 -scsi1 /dev/disk/by-id/ata-MY_DISK_MODEL_SERIAL-1

Examples I used on a virtual file host:

qm set 104 -virtio1 /dev/disk/by-id/ata-MY_DISK_MODEL_SERIAL-1
qm set 104 -virtio2 /dev/disk/by-id/usb-MY_DISK_MODEL_SERIAL-2-0:0

Install private key AND certificate into web UI. Here's where they'd be on an OpenBSD CA server:

cat /etc/ssl/private/proxmox.key.pem
cat /etc/ssl/ca-server/intermediate/certs/proxmox-chain.crt.pem

Set new server:

nano /etc/chrony/chrony.conf

Check logs:

journalctl --since -1h -u chrony

Check status:

chronyc tracking

Types: deb
URIs: http://download.proxmox.com/debian/pve
Suites: trixie
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg

Disk commands:

Back to top ↑