Linux VPS

P2V: convert a physical server into a virtual machine

Plan and perform a physical-to-virtual (P2V) migration: disk imaging with dd or Clonezilla, converting to qcow2, booting on KVM or Proxmox, fixing drivers, network and licensing afterwards.

AdvancedPhysical servers and KVM hosts2 min read

Old physical servers often run software nobody wants to reinstall. A physical-to-virtual (P2V) migration copies the whole machine into a VM, so you can retire the hardware while keeping the system running, with snapshots and backups on top.

Before you start

  • A KVM or Proxmox host with enough space; see install KVM.
  • A maintenance window; for consistency, image the disks while the OS is shut down (boot a live USB).
  • A full backup of the physical server.
  • Check software licences that are bound to hardware (some re-activate after moving).

Option 1: image with dd over SSH

Boot the physical server from a Linux live USB, then stream the disk to the KVM host:

dd if=/dev/sda bs=4M status=progress | gzip -1 | ssh root@kvm1 "gunzip | dd of=/var/lib/libvirt/images/oldsrv.raw bs=4M"

Then convert to qcow2 to save space:

qemu-img convert -p -O qcow2 oldsrv.raw oldsrv.qcow2

Option 2: Clonezilla

Clonezilla images the used blocks only and can restore into an empty VM disk. Save an image to an SSH or NFS share, create a VM with a disk at least as large as the original, boot Clonezilla in the VM and restore.

Option 3: virt-p2v

The libguestfs project's virt-p2v boots on the physical machine and sends it to a conversion server running virt-v2v, which also injects VirtIO drivers. Useful for Windows and RHEL-family systems.

Create and boot the VM

virt-install --name oldsrv --memory 4096 --vcpus 2 --disk /var/lib/libvirt/images/oldsrv.qcow2,bus=sata --import --os-variant generic --network bridge=br0,model=e1000e --graphics vnc,listen=127.0.0.1 --noautoconsole

Start with SATA disk and e1000e network for compatibility, and match BIOS vs UEFI to the original (add --boot uefi if it used UEFI).

Fix things after first boot

  • Linux: rebuild the initramfs with VirtIO modules, switch to VirtIO devices, update network interface names and fstab (use UUIDs).
  • Windows: install virtio-win drivers, then switch to VirtIO; see Windows VMs on KVM.
  • Remove hardware vendor agents (RAID tools, IPMI drivers) that no longer apply.
  • Install the QEMU guest agent.
  • Shrink oversized disks later if needed, and right-size CPU/RAM.

Troubleshooting

  • Boots to "no bootable device": firmware mismatch or the wrong disk was imaged.
  • Kernel panic "unable to mount root": missing storage driver; use SATA and rebuild initramfs.
  • Windows INACCESSIBLE_BOOT_DEVICE: boot with SATA, install VirtIO drivers, then switch.
  • IP conflict: keep the physical server offline or change one IP.

Frequently asked questions

Can I do P2V without downtime?

Live imaging is possible with some tools, but a shutdown gives a consistent copy.

Is it better to rebuild?

Rebuilding on a fresh OS is cleaner long-term; P2V is a pragmatic step for legacy systems.

Does Proxmox support importing the disk?

Yes, use qm importdisk with the converted image.

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.