Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am searching for information on mapping an existing drive (USB drive) to a KVM virtual machine using libvirt. I have been going over http://libvirt.org/formatstorage.html#StoragePoolTarget. But I don't quite understand what options are needed to expose an existing device to the VM (or if it is even possible).

From what I am reading, the target element is expecting a path element to a folder on the machine to store a file based image. Can the path be a device such as /dev/sdc1? with a type of raw?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Check out the 'USB passthrough | Using Libvirt' section of this page from the Edubuntu wiki. More info here and here.

If you don't ever plan to hot plug/unplug the usb drive while the guest is running you could also try adding a section like

<disk type='block' device='disk'>
  <driver name='qemu' type='raw'/>
  <source dev='/dev/sdb'/>
  <target dev='sdb' bus='scsi'/>

to your VM's xml definition file. Just change the source dev to match what was assigned to your usb when it was plugged in. However, you can't guarantee the usb's dev assignment will survive reboot if other devices are added or removed, so I'd recommend the approach in the first link above instead.

share|improve this answer
Thanks, that page was very helpful. I did get it working. But instead of a vendor and product, I used the address element. When using vendor and product I couldn't mount 2 USB drives that were the same. It would only pass through the first one. –  Andy Shinn Jan 11 '12 at 22:26

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.