KVM booting off-image kernel and existing partition

I've been researching this topic as well and just posted a somewhat similar question, but with a different scope: KVM/qemu - use LVM volumes directly without image file?

For your particular question, does this work: https://wiki.archlinux.org/index.php/QEMU#By_specifying_kernel_and_initrd_manually

In particular, -append root=/dev/sda /dev/sda3. I haven't tried it myself, but it seems like it should do what you want.


Answers from dynasy and Jared are both pointing in the right direction, but leaves a bit unexplained.

The short answer to my question is that virt-install is perfectly capable of supplying a partition to the booting system. In fact, for block devices, it doesn't care and just pass it on to qemu that sets it up like a block device. Then the kernel uses /dev/sda (rather than /dev/sda1) as root file system.

The command line for achieving this looks like this:

virt-install --name nic 
  --ram 512 
  --disk /dev/vg_ext/nic-standalone
  --disk /dev/vg_ext/nic-swap
  --network bridge=br0
  --boot kernel=/boot/vmlinuz,initrd=/boot/initramfs.img,kernel_args="console=ttyS0 root=/dev/sda" 
  --serial=pty

In order to make this work, I had to modify /etc/fstab on nic-standalone so that it pointed to the correct root file system and swap partition (/dev/sda, /dev/sdb). Kernel and initrd above are standard CentOS 6 stuff. (There may be various performance parameters/tweaks desired as well, I just haven't gotten that far yet.)


Simply create a new VM in virt-manager or via virsh with similar parameters as the Xen one (memory, CPU etc), and when asked to create virtual disks for it, point to the existing Xen disks.

You might need to adjust fstab a bit, to point to /dev/vdX instead of xvdX (or whatever Xen uses)

If you want a really nice move procedure that will take care of everything for you, you can use virt-v2v.