Skip to content

ESXi to Proxmox (V2P)

PegaProx ships a full V2P (ESXi-to-Proxmox) engine that imports running VMs from ESXi hosts to Proxmox VE - across all major target storage types and with optional Windows VirtIO driver pre-staging. Heavily reworked in v0.9.7.1 and v0.9.8: the legacy "stop and copy" path is still there, but the default is a live drive-mirror with sub-second cutover.

The migration engine lives in pegaprox/core/v2p.py. Modes are selectable per-job from the wizard or via the transfer_mode field of the /api/vmware/{vmware_id}/vms/{vm_id}/migrate POST body.

Migration Modes

The mode is selected via the transfer_mode field.

transfer_mode Downtime How it works
vmkfstools_clone Grows with disk size (from 1.3) Default/recommended. Snapshots the running VM, vmkfstools-clones the frozen base at the ESXi vmkernel level and imports it to any Proxmox storage (Ceph/RBD, LVM, LVM-Thin, dir) while the VM keeps running. At the switchover it stops the source and carries over every block changed since the snapshot. No locked-base-disk problem.
auto As vmkfstools_clone Uses the vmkfstools_clone path; falls back to the pre-sync path only if the source cannot be snapshotted or cloned.
sshfs_boot ~30s SSH-mounts the VMFS and QEMU drive-mirrors disks live, then atomic pause-pivot-resume.
snapshot_zero ~10s ESXi snapshot-rotation iterative delta. Experimental, known to report success with missing or wrong data on the target; do not use it for guests whose data matters.
offline Minutes–hours Shuts the source down, streams disks via SSH dd, converts. Maximum reliability.

Before 1.3: writes after the snapshot were not carried over (#1124)

Up to 1.2, vmkfstools_clone and auto copied the disks from a snapshot and did not replay later changes, so anything written to the running source during the copy or the confirmation hold was missing on the target. On 1.2, shut the source VM down before you start, or use offline.

From 1.3 the switchover does it right: it stops the source, waits until the snapshot is folded back on ESXi, compares every 256 MiB block of each disk with the copy and transfers what changed, reads the changed blocks back, and only then runs the post-copy steps (UEFI loader, VirtIO drivers, qcow2) and starts the target. If anything fails before the target runs, the source is powered back on. The comparison reads each disk once on ESXi, so plan the downtime by disk size; for the shortest downtime on large disks use sshfs_boot.

Live Mirror Cutover (sshfs_boot) - Step-by-Step

Plan & pre-flight

Source VM config is fetched via pyvmomi. SCSI controller, NIC model, firmware (BIOS / OVMF), Secure Boot, TPM, CPU topology and disk layout are auto-detected and translated to Proxmox QEMU args. Target storage capacity is validated.

SSHFS-mount the VMFS

PegaProx pushes a temporary SSH key to the ESXi host (30 min TTL, auto-cleaned), then mounts the source datastore on the target Proxmox node via SSHFS so the VMDKs are visible as a local filesystem.

Create skeleton VM

Empty target VM is created with matching CPU/RAM and the disks pre-allocated on the chosen Proxmox storage. For OVMF guests an efidisk0 with pre-enrolled-keys=1 is added so Secure Boot keys persist.

Live drive_mirror

QEMU on the target opens the live VMDK via SSHFS and runs a drive_mirror over QMP. Source keeps running, every dirty block is mirrored to the target storage in real time. Progress is reported per-disk via SSE.

VirtIO injection is not available on sshfs_boot

On the sshfs_boot live-pivot path the target is already running when the disks pivot, so offline hive editing is unsafe. Use transfer_mode = vmkfstools_clone / auto / snapshot_zero / offline to pre-stage drivers, or install them post-boot from the virtio-win.iso CD-ROM. See VirtIO Pre-Staging.

Atomic pivot

QMP block-job-cancel with force=false waits for sync, then cont resumes the target on Proxmox storage. The source is shut down via the ESXi API. Total downtime: typically < 1 second.

Cleanup

SSHFS unmounted, temp SSH key removed from ESXi, source VM stays present (off) so you can verify.

Storage-Aware Disk Handling

The same job runs against any target storage - PegaProx dispatches per disk:

Target Storage Disk Path Open Mechanism
LVM-Thin / iSCSI LVM /dev/<vg>/<lv> Direct block-device write
ZFS zvol /dev/zvol/<pool>/<dataset> Direct block-device write
Ceph RBD (rbd:pool/vmid-disk-N) rbd map → loop, then qemu-nbd for offline-edit hooks
NFS / CIFS / CephFS vm-<vmid>-disk-N.qcow2 qemu-nbd attach for offline-edit hooks

vSAN as the migration source

The transfer paths read each source disk as a flat VMDK extent (-flat.vmdk). vSAN stores VMDKs as objects with no separate flat extent, so migrating a VM directly off vSAN trips the disk-size / RDM guard and fails. Workaround: Storage-vMotion the VM from vSAN onto a VMFS or local ESXi datastore first - that materialises a normal -flat.vmdk - then run the migration from there.

4K LUN Compatibility

Some enterprise iSCSI targets present 4K logical sectors. Many older Windows installer ISOs and certain Linux bootloaders refuse to boot on 4Kn devices. PegaProx adds -device scsi-hd,...,logical_block_size=512,physical_block_size=4096 to the target QEMU args automatically when 4K LUNs are detected - Windows sees a 512e disk and boots normally, no driver dance required.

OVMF / Secure Boot / TPM

  • OVMF firmware: auto-detected from the ESXi firmware: efi setting. Target gets bios: ovmf + efidisk0 with pre-enrolled Microsoft keys.
  • Secure Boot: preserved via efidisk NVRAM. Source's secure-boot state is mirrored.
  • TPM 2.0: a fresh swtpm v2 state is provisioned on the target - Windows 11 BitLocker users will need to suspend/resume protection on first boot (this is an unavoidable side effect of TPM not being live-migratable from ESXi).
  • BOOTX64.EFI fallback: if a Windows guest was originally installed without UEFI NVRAM entries (rare but seen on some ESXi imports), PegaProx writes \EFI\Boot\BOOTX64.EFI as a fallback so the firmware finds the loader without manual bcdboot.

Hardware Translation

The wizard auto-detects and pre-fills 28 settings; everything is editable per-disk and per-NIC. Reasonable defaults:

ESXi Detected → Proxmox default
LSI Logic SAS / PVSCSI virtio-scsi-pci (with VirtIO injection on) / lsi (off)
VMXNET3 virtio (with VirtIO injection on) / e1000 (off)
E1000 e1000
Firmware bios seabios
Firmware efi ovmf + efidisk0
Secure Boot enabled OVMF with pre-enrolled Microsoft keys
TPM 2.0 present tpmstate0 via swtpm
NUMA topology cores + sockets matching source

Requirements

  • SSH enabled on the ESXi host (port 22, root or admin role)
  • ESXi host with read access to source datastores
  • SSHFS available on the target Proxmox node (Debian: apt install sshfs)
  • For VirtIO injection: python3-hivex, ntfs-3g, ntfsprogs on the target node - see VirtIO Pre-Staging
  • pyvmomi >= 8.0.0 on PegaProx (included in requirements.txt)
  • Optional: tc qdisc bandwidth-limit on the SSHFS interface to keep migrations off the production path

OpenCollective Banner (v0.9.8)

The V2P wizard now opens with a non-invasive awareness panel: "Only with your support can we keep this feature free." Includes the OpenCollective logo and a mandatory Acknowledge checkbox before "Next" enables. The donation flow is optional - the migration is not gated.

New migration-wizard fields

The migration wizard exposes two additional fields:

  • ESXi SSH user (#602): the wizard now surfaces the ESXi SSH user, so the vmkfstools/SSH transfer can authenticate as a non-root ESXi account instead of requiring root.
  • Target NIC VLAN tag (#598): you can set a VLAN tag (1–4094) on the target NIC that is created on the Proxmox side.

Changes in 1.3

  • The ESXi host is the registered one. The migration always reads from the host of the registered ESXi server; a request naming another esxi_host is refused.
  • Removing the source at the confirmed cutover needs vmware.vm.manage on the source VM (starting the migration needs vmware.vm.migrate).
  • Strict host keys (PEGAPROX_SSH_STRICT_HOST_KEYS=1) now also apply to the SSH connections the Proxmox node opens to the ESXi host: the node's root known_hosts must already hold the ESXi host key.
  • Node-side files stay private: the temporary ESXi key and credential files on the Proxmox node are readable by root only, the datastore mount is no longer shared with other users, and the ESXi password no longer appears in the VM configuration or the task log.
  • Disk copies run over the encrypted SSH stream; the unauthenticated netcat transfer is gone.
  • VirtIO ISO: a custom virtio_iso_path must be an absolute path to an .iso file.
  • Block storage on Proxmox 9: V2P disks on block storage are allocated as raw (#816).

API

Method Endpoint Description
POST /api/vmware Add/connect an ESXi source (host, user, password)
GET /api/vmware/{vmware_id}/vms List source VMs
GET /api/vmware/{vmware_id}/vms/{vm_id}/migration-plan Auto-detected hardware translation plan
POST /api/vmware/{vmware_id}/vms/{vm_id}/migrate Start migration (body: target_cluster, target_node, target_storage, esxi_password; optional esxi_host, esxi_datastore, esxi_vm_dir, transfer_mode, install_virtio_drivers). Requires permission vmware.vm.migrate
GET /api/vmware/migrations List all migrations
GET /api/vmware/migrations/{mid} Migration status + per-phase progress

Live progress

Progress is delivered on the shared SSE stream as vmware_migration and vmware_migration_log events - there is no dedicated per-job SSE endpoint.