5

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?

1
  • 1
    Seems not unreasonable for a one-off. Jul 3, 2014 at 12:59

3 Answers 3

4

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

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

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .