As organizations look to optimize virtualization costs and embrace open-source solutions, migrating from VMware to KVM becomes a strategic choice. Here’s a straightforward guide to help you move your VMware virtual machines (VMs) to a KVM-based deployment using qemu-img.
🔁 Step-by-Step Migration Process
1. Clone the Running VMware VM
Ensure the VM you want to migrate is cloned to avoid affecting the production instance.
2. Download the VMDK Files
Once cloned, download the VM directory. It usually contains two important files:
- vmname.vmdk
- vmname-flat.vmdk
✅ Note: You’ll only use the vmname.vmdk file in the conversion process.
3. Install qemu-img for Conversion
Depending on your platform, install the qemu-img tool:
- Windows:
Download qemu-img for Windows (v2.3.0) - Linux:
- RHEL/CentOS/Rocky/AlmaLinux:
- Ubuntu/Debian:
4. Convert VMDK to QCOW2 Format
Use the following command to convert the VMDK to a KVM-compatible .qcow2 file:
bashCopyEditqemu-img convert -f vmdk -O qcow2 vmname.vmdk vmname .qcow2
⚠️ Important: Do not use the vmname-flat.vmdk. Always convert from vmname.vmdk.
5. Upload the QCOW2 Image
Move the converted .qcow2 file to your KVM host. You can upload it to your preferred image storage location (e.g., /var/lib/libvirt/images/).
6. Configure the VM in KVM
While creating the VM on your KVM hypervisor (e.g., via virt-manager, virt-install, or any front-end):
- Select the .qcow2 image as the disk.
- Choose SATA as the disk interface.
- Match the BIOS/UEFI configuration from the VMware VM:
- Use q35 + BIOS for legacy systems.
- Use q35 + UEFI for modern UEFI systems.
7. Boot the VM
Power on the VM in your KVM environment. If all settings align (especially disk interface and firmware type), your VM should boot successfully.
✅ Final Tips
- Always validate the VM functionality after boot — networking, disk mounts, and installed services.
- Consider using virtio drivers post-boot for improved disk and network performance on KVM.
- You can also automate parts of this process using tools like virt-v2v if migrating at scale.
bashCopyEditsudo apt-get install qemu-utils
bashCopyEditsudo dnf install qemu-img
Leave a comment