Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am in the process of switching from Xen to qemu-kvm. My current Xen installation has a number of LVM volumes each with a partition (rather than a full disk image). In Xen, I start each VM with a configuration like so:

kernel = "/boot/vmlinuz-2.6.18-128.4.1.el5xen"
ramdisk = "/boot/initrd-xen-2.6.18-128.4.1.el5xen"
disk   = [ 'phy:/dev/vmdata/vm-standalone,sda1,w' ]

I now want to reuse these VMs but start them under kvm instead. It seems that virt-install --import would let me do this, using --boot kernel=<kernel>,initrd=<initrd>, but I don't see how I can instruct virt-install to attach the existing volume as boot/root file system. Is this possible?

share|improve this question

3 Answers 3

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:

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

share|improve this answer

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 cirtual disks for it, point to the existing Xen disks.

you might need to adjust fstab a bit, to poind 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

share|improve this answer
up vote 1 down vote accepted

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" 

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.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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