How to migrate a virtual machine from KVM hypervisor to PROXMOX

We will assume throughout the article that we want to migrate the webserver virtual machine from kvm hypervisor to proxmox

1 — From the kvm hypervisor, export the webserver virtual machine in qcow2 format

qemu-img convert -O qcow2 /dev/vg0/lv_webserver /data/images/webserver01.qcow2

2 — Copy the disk to the proxmox server

scp /data/images/webserver01.qcow2 serverproxmox:/data/

3 — Create a machine on the proxmox server

qm create 114 — name webserver02 — memory 2048 — net0 virtio,bridge=vmbr0

114 is the id of the VM proxmox

4 — Import the disk

qm importdisk 114 webserver01.qcow2 local-vms

local-vms is the storage space

5 — We associate the new disk to the virtual machine created on proxmox

qm set 114 — scsihw virtio-scsi-pci — scsi0 local-vms:vm-114-disk-0

vm-114-disk-0 is the name of the virtual machine disk after import

6 — Add a virtual serial port to the VM to be able to connect from the command line

qm set 114 -serial0 socket

7 — Start the virtual machine

qm start 114