Linux VPS

Convert VMware VMDK or Hyper-V VHDX disks to KVM qcow2

Migrate a virtual machine from VMware, VirtualBox or Hyper-V to KVM: export the disk, convert VMDK, VDI or VHDX to qcow2 with qemu-img, import it with virt-install and fix drivers.

IntermediateKVM hosts2 min read

Moving a VM from VMware, VirtualBox or Hyper-V to KVM usually comes down to converting its disk. qemu-img reads all the common formats, so you can convert VMDK or VHDX to qcow2 and boot the same system on KVM or Proxmox VE.

Before you start

  • A KVM host with qemu-img and virt-install; see install KVM on Ubuntu.
  • The source VM shut down cleanly (not suspended) and any snapshots consolidated.
  • Free disk space for the converted image, at least the source's used size.
  • A backup of the original VM.

Prepare the source VM

  • Linux guests: make sure VirtIO modules are in the initramfs (most modern distributions include them).
  • Windows guests: install the virtio-win drivers before migrating, or plan to boot with an emulated SATA disk first. See VirtIO drivers.
  • Uninstall VMware Tools or Hyper-V-specific agents if possible.

Export the disk

SourceDisk formatWhere to find it
VMware ESXi / WorkstationVMDKDatastore browser or VM folder (copy the descriptor and -flat.vmdk)
VirtualBoxVDI or VMDKVM folder under VirtualBox VMs
Hyper-VVHDX or VHDHyper-V virtual hard disks folder

Copy it to the KVM host with scp or rsync.

Convert the disk to qcow2

qemu-img convert -p -f vmdk -O qcow2 web01.vmdk /var/lib/libvirt/images/web01.qcow2

For other formats change -f: vdi, vhdx or vpc (for legacy VHD). Inspect the result:

qemu-img info /var/lib/libvirt/images/web01.qcow2

Import the VM

virt-install --name web01 --memory 4096 --vcpus 2 --disk /var/lib/libvirt/images/web01.qcow2,bus=virtio --import --os-variant ubuntu22.04 --network bridge=br0,model=virtio --graphics vnc,listen=127.0.0.1 --noautoconsole
  • If the source used UEFI, add --boot uefi.
  • For Windows without VirtIO drivers yet, use bus=sata and model=e1000e first.

Proxmox users can run qm importdisk or use the ESXi import wizard in recent versions.

Fix things after first boot

  • Network interface renamed (e.g. ens160 becomes enp1s0): update Netplan or NetworkManager config. See static IP with Netplan.
  • Windows: install virtio-win guest tools, then switch disk and NIC to VirtIO.
  • Install qemu-guest-agent.

Troubleshooting

  • "No bootable device": BIOS/UEFI mismatch; match the source's firmware.
  • Linux drops to emergency shell: missing VirtIO drivers in initramfs or fstab using old device names; boot with SATA, rebuild initramfs, use UUIDs.
  • Windows INACCESSIBLE_BOOT_DEVICE: no storage driver for the new controller; boot with SATA first.

Frequently asked questions

Can I convert while the VM runs?

Not safely. Convert from a clean shutdown or an exported snapshot.

Should I convert to raw instead?

Use -O raw if you will place the disk on LVM or ZFS. See qcow2 vs raw.

Does virt-v2v help?

Yes. virt-v2v automates conversion and driver injection, especially for VMware and Windows sources.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.