I have a fairly old debian machine that I need to migrate to KVM-Qemu.

What I started is to make a tarball of the root filesystem:

tar -cpf rootfs.tar  --exclude='dev/*' --exclude='proc/*' --exclude='sys/*' --exclude='home/*' /

scp tar file to a running kvm machine, make small changes, then hope it works. Anybody knows a better solution than this?


Why not use the actual software created for this use case? What you need is virt-p2v

  • Good idea, but it's a bit of work if you only have one machine to do. – Michael Hampton Jul 4 '14 at 15:07
  • can't always get what you want, eh? – dyasny Jul 7 '14 at 1:09
  • But if you try sometimes, you might find, you get what you need. – Michael Hampton Jul 7 '14 at 1:14
  • But if you tar sometimes... – Belmin Fernandez Jul 15 '14 at 14:13

If you want the size of the virtual disk on the VM to be the same as the physical disk you were using on your physical machine, then you can simply copy the entire disk to a disk image. You put this disk image on the host system while the VM is down. The command to copy the disk could look like this:

ssh -C vhost dd of=/path/to/image < /dev/sda

It is best to run this with all file systems mounted read-only on the source.


I wrote a step-by-step detailed answer of how I solved a very similar challenge on the question: Turning a running Linux system into a KVM instance on another machine. I hope it proves a useful answer for this question too.

Goal of the answer: to take a physical Linux P node running live-production and virtualise it. Without having to create and allocate multi terabyte disks, nor have to use md raid in the V guest, because the target hypervisor (Proxmox 5) used ZoL/ZFS. Also wanted to mitigate downtime/reboots on the running P node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.