[GLLUG] Does any virtualisation system provide good support for USB device forwarding?

Richard W.M. Jones rich at annexia.org
Tue Apr 8 16:34:58 UTC 2014

On Tue, Apr 08, 2014 at 05:02:36PM +0100, John Winters wrote:
> There are lots of HOWTOs on the net about how to migrate existing
> VMs from Xen to KVM, but they all run up against a fundamental
> difference in how the two do disk allocation.  Xen expects to have
> several devices - one for swap, and one for each mountable partition
> - whilst KVM expects to be passed a whole disk (albeit not a real
> one) which it then partitions for swap, boot etc.  Any kind of
> conversion will therefore be a messy compromise.

It's actually a bit more subtle.  As you say, Xen takes several host
files and constructs a virtual partition table, with each file
corresponding to a partition on the virtually constructed disk.

There's no real reason why Linux virtual machines need to see a
partition table at all.  They will be happy as larry with their
filesystems on virtual /dev/sda, /dev/sdb and so on, and booting from
an external kernel & initrd on the host.  Windows, unfortunately,
won't mount filesystems at all unless they appear in partitions with
the proper MBR type byte set, so if you have Windows guests then you
have a problem.

You can emulate the Xen way of doing things using dmsetup commands,
but TBH it's extremely tedious to work out the mappings by hand (and
dangerous too if you mis-key a device minor number).

An easier way (IMHO) is to use libguestfs to construct a partitioned
virtual disk from your partitionless files:


After using those instructions, use 'virt-rescue' to give you a rescue
shell, and then install grub.  (I believe that Windows guests should
just boot without further attention, provided you copy an MBR onto the
first sector and make sure the first partition is marked as active/
bootable in the partition table, which you can do with the guestfish
command 'part-set-bootable', or plain old fdisk).

The alternative it to forget about grub/NTLDR and use syslinux or
extlinux.  Libguestfs can install this, and it's a lot simpler to use
and configure.

Yes, this is a lot more tedious than it should be.  Personally I'm
going to blame Xen for having a weird disk format :-)  It's suggestive
that no other hypervisor has gone down the same route as Xen.

Red Hat has a tool called virt-v2v which can convert a limited
selection of Xen guests to run on KVM, but AFAIK it doesn't deal with
the disk issue above at all since RHEL 5 Xen didn't use partitionless


Richard Jones
Red Hat

More information about the GLLUG mailing list