Xen - Xen USB Transfer (2023)


  • 1. General Information
    • 1.1 USB emulated
    • 1.2 PVUSB
  • 2 details
    • 2.1 Specifying a USB host device
    • 2.2 Host-USB en xl
    • 2.3 USB host in xm/xend
      • 2.3.1 USB Emulator in xm/xend
      • 2.3.2 PVUSB en xm/xend
      • 2.3.3 PVUSB en xl/libxl
  • 3 More information
    • Support for 3.1 PVUSB in Xen 4.0 and newer versions

There are two general methods for forwarding individual host devices to a guest. The first is through an emulated USB device driver; the second is PVUSB.

Also, there are two ways to add USB devices to a guest: via the configuration file at domain creation time, and via hot plugging while the VM is running.

Another popular way to pass USB devices, especially for gaming rigs, is to usePCI passpass all USB host driver. This results in the lowest overhead and the best feature support. However, it does mean that you can't allow the guest to select individual USB devices on a controller - it's all or nothing. This is suitable for PV and HVM guests.

There are also non-Xen solutions likeIP USB, in which USB devices are shared over the network.

emulated usb

With emulated USB, the device model (qemu) presents an emulated USB driver to the guest. The device model process then takes control of the device from domain 0 and forwards USB commands between the guest operating system and the host USB device.

This method is only available for HVM domains and is not available for domains running withDevice model stub domains.


PVUSB uses a paravirtualized front-end/back-end interface similar to traditional Xen-PV disk and network protocols. To use PVUSB, you need usbfront on your guest OS and usbback on dom0 or usb backend on qemu (or your USB controller domain).

(Video) XCP-NG USB passthrough howto

Unfortunately, kernel support for the PVUSB protocol is currently not very good. The next section provides links to more information about PVUSB driver support.

Also, to simply use PVUSB, you need support in the tooltack for the two sides to talk to each other. (Alternatively, you can write a script to manually communicate with frontends and backends via xenstore - see the section below for more information.)

PVUSB currently supports USB 1.1 and USB 2.0. PVUSB supports both PV and HVM guests.

As of Xen 4.4, PVUSB is only supported by the xm/xend tool stack.

Starting with Xen 4.7, PVUSB support for the XL/libxl tooltack is introduced. For PVUSB in xl, the USB backend can be usbback in dom0 or the USB backend in qemu, called “qusb”. Later one is still in progress.

Specify a USB host device

USB devices are primarily identified by their bus address (in the formdevice.bus) or its device tag (in the formVendor ID: Device ID).

Each type of specification has its advantages:

  • Specifying by device tag always retrieves the same device, regardless of where the device ends up in the USB bus topology. However, if there are two identical devices, you cannot specify which one.
  • When specifying by bus address, you can always select a specific device, even if you have duplicates. However, the bus address may change depending on the port you have connected the device to and possibly also after a reboot.

You can usesubTo list the USB devices on the system:

Bus 001 Dispositivo 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 HubBus 003 Dispositivo 002: ID f617:0905 Bus 001 Dispositivo 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Dispositivo 004: ID 0424:2640 Standard Microsystems Corp. USB 2.0 HubBus 001 Dispositivo 005: ID 0424:4060 Standard Microsystems Corp. Ultra Fast Media ReaderBus 001 Dispositivo 006: ID 046d:c016 Logitech, Inc. Ratón óptico con rueda

For example, for Logitec hover, you can specify both046d:c016o1.6.

use: lsusb lists the bus and device number with leading zeros, but you must remove them when specifying the device in xl. (The leading zeros cause xl to interpret the number as octal.)

(Video) How to add additional hard disk in xenserver

host usb en xl

As of Xen 4.6, xl only supports emulated USB from the configuration file.

Enable the emulated USB hub withUSB = 1. Then specify the devices in the device list in the config file along with other emulated devices usingHost: USB ID. For example:


The default USB driver created by qemu is USB 1.1. For some devices this is not enough. For this reason, you can also specify the USB driver version from 4.6usb version. However, this is not supported at this time.usb device, and is therefore only useful in connection with Spice USB Redirection. This option is not available for qemu-traditional.

Xen 4.7 introduces support for xl PVUSB and hot plugging.

Include USB drivers and USB host devices in the configuration filectrlusbYusbdev. For example:

usbctrl=['type=pv,version=2,ports=4', 'type=pv,version=1, ports=4', ]usbdev=['hostbus=2, hostaddr=1, driver=0,port= 1', ]

Use commands to hot plug a PVUSB deviceusbctrl-attach,usbctrl-detach,USB list,usbdev-attachYusb-disconnect. For example:

#xl usbctrl-attach test_vm version=1 ports=8 This will create an 8 port USB 1.1 version USB controller. #xl usb-list test_vmThis shows all USB controllers and USB devices in the domain. #xl usbdev-attach test_vm hostbus=1 hostaddr=2 This finds the first available controller:port in the domain and adds a USB device whose busnum:devnum is 1:2. You can also specify <code>controller</code> and <code>port</code>. #xl usbdev-detach test_vm 0 1This detaches the USB device under port 1 of controller 0. #xl usbctrl-detach test_vm dev_idThis detaches the USB controller with the specified dev_id and all USB devices below it.

USB host in xm/xend

use:xend/xmit has been deprecated since 4.2 and was removed from Xen 4.5.

xendsupports both emulated USB and PVUSB.

Note, however, that the emulated USB and PVUSB use different command sets, both for hotplug and in the configuration file, and the naming scheme is not very obvious.

USB emulator in xm/xend

To use emulated USB, you need to enable it in the configuration fileUSB = 1.

(Video) Tutorial: Configuring Backups For XCP NG Using Xen Orchestra 2021

You can specify a device in the configuration file; but unfortunately thexendsyntax forusb deviceit only allows you to specify a single USB device of any type:


Fortunately, you can also hot plug and unplug devices after boot:

  • Add usb xm domain host: xx.yy
  • xm usb-del Domänenhost: xx.yy

xendonly supports USB 1.1 like xm/xend only supports qemu-dm-traditional. USB 2.0 and USB 3.0 are only supported by qemu-upstream and XL.

PVUSB en xm/xend

PVUSB uses the following hot plug commands:create-usb-hc,destroy usb-hc,Puerto USB,usb-destroy

PVUSB can also be specified in the configuration file via thevusbpolicy.

Please take a look...xmYxm.cfgmanual pages for more information.

PVUSB en xl/libxl

Support for PVUSB in xl/libxl has been introduced since Xen 4.7, including the configuration file PVUSB device and the hot plug/unplug PVUSB device. It is currently backwards compatible with USB 1.1 and USB 2.0.

Include USB drivers and USB host devices in the configuration filectrlusbYusbdev. For example:

usbctrl=['type=qusb, version=2, ports=4', 'type=qusb, version=1, ports=4', ]usbdev=['hostbus=2, hostaddr=1, driver=0, port= 1', ]

Fortypeyou can specifyAuto(Default: xl tries to choose the most suitable type),Era(paravirtualized qemu based backend, must be specified for pvUSB used by HVM domains),p.v.(kernel-based paravirtualized backend, not compatible with current Linux standard), ordevice model(qemu emulated USB driver, not supported yet).

You can also specifyusbdevjust for example:

(Video) USB Transfer

usbdev=['hostbus=2, hostaddr=1, ]

Then an 8-port version 2.0 USB controller will be created automatically and the USB device will be connected to the first port of this new controller.

Use commands to hot plug and unplug a PVUSB deviceusbctrl-attach,usbctrl-detach,USB list,usbdev-attachYusbdev-detach. For example:

#xl usbctrl-attach test_vm version=1 puertos=8

This creates an 8-port USB 1.1 USB controller.

#xl Lista USB test_vm

This will show all USB controllers and USB devices in the domain.

#xl usbdev-attach test_vm hostbus=1 hostaddr=2

This will find the first available controller:port in the domain and connect a USB device whose busnum:devnum is 1:2. You can also specifyStandardsYPuerto.

#xl usbdev-detach test_vm 0 1

This will disconnect the USB device under port 1 of controller 0.

#xl usbctrl-separar test_vm dev_id

This will remove the USB controller with the specified dev_id and all USB devices below it.

PVUSB support in Xen 4.0 and newer versions

PVUSB is a new high-performance USB transfer method from dom0 to guests, backwards compatible with USB 2.0 and USB 1.1 devices. PVUSB does not use Qemu-dm. PVUSB can be used with both HVM and PV domU, but requires special pvusb drivers in the dom0 kernel (xen-usbback) and frontend driver (xen-usbfront) in the VM.

presentation slides via PVUSBXenCumbres(contains usage examples and syntax):

Links to PVUSB:

(Video) Xenserver Hard Drive / Whole Disk Passthrough with XCP-NG

Xen Linux kernel with PVUSB support included:

Learn more about the different kernel versions and the drivers they contain:

  • List of various kernel trees supported by Xen dom0 for Linux:XenDom0Kernel:
  • List of Xen features in different Linux kernel trees:Features of XenKernel:

Windows Xen PVUSB-Treiber (interfaces):


How do I map a USB port to a Hyper V virtual machine? ›

Go to the settings of your VM and click on SCSI controller. Add the type "HardDrive" Go to the newly create harddrive in the Hyper-V settings menu and click on the option Physical harddrive. You should be able to select the USB drive.

Does Hyper-V allow USB passthrough? ›

Hyper-V supports four different methods of USB passthrough you can use to directly access USB devices from a VM: network-level redirection, server-side redirection by attaching the device as a SCSI drive, client-side redirection via the Enhanced Session Mode, and RDP connection.

How do I transfer files from USB to virtual machine? ›

Computer hardware/software : Windows, Mac, Linux, etc. The simple answer is: enable USB access in your VM control panel to USB ports. They will then function just like they do in the native operating system.
  1. Click to open the virtual machine.
  2. Select the decompressed. VMX file.
  3. Start the VM.
  4. Select you have copied this VM.

How do I insert a USB drive? ›

Insert the flash drive into a USB port on your computer. You should find a USB port on the front, back, or side of your computer (the location may vary depending on whether you have a desktop or a laptop). Depending on how your computer is set up, a dialog box may appear. If it does, select Open folder to view files.

How do I make my USB accessible? ›

Modify the Ownership of the inaccessible USB drive
  1. Right-click on the inaccessible USB drive and choose Properties.
  2. Select the Security Tab.
  3. Under Group or user names, choose your account name to check if you have permission to access the USB drive.
  4. Select the files you want to get back and then click Recover.

How do I make my USB ports accessible? ›

Enable USB Ports via Device Manager
  1. Click the Start button and type "device manager" or "devmgmt. ...
  2. Click "Universal Serial Bus controllers" to see a list of USB ports on the computer.
  3. Right-click each USB port, then click "Enable." If this does not re-enable the USB ports, right-click each again and select "Uninstall."

Can VirtualBox access USB? ›

1. USB Settings. The USB section in a virtual machine's Settings window enables you to configure Oracle VM VirtualBox's sophisticated USB support. Oracle VM VirtualBox can enable virtual machines to access the USB devices on your host directly.

Is USB passthrough useful? ›

USB passthrough is a super helpful feature that generally comes standard on higher end gaming keyboards. The USB passthrough makes plugging in additional USB devices breeze, especially devices with a shorter cable. If you're gaming, you can plug a standing microphone straight into your keyboard.

How do I get my virtual machine to recognize my USB? ›

Within settings, browse to the USB tab and click the Add button on the very right of the window. Select the USB device that you wish to use from the list. Once done, click OK to save changes and exit. Now go back into your VM window, and from the Host options, select Device > Usb Devices > “your USB device.”

How to detect USB drive in Hyper-V? ›

Connect your phone to the USB port of your machine. Then start RDC and go to Options . From there go to Local Resources and at the bottom Local devices and resources . Click the More button and then check the box for `Other supported Plug and Play (PnP) devices.

How do I get my virtual machine to read USB? ›

Launch VirtualBox on your system. Right-click on the Windows virtual machine and then select Settings options from the context menu. Click on the USB option present in the vertical menu. You will notice that the Enable USB Controller option is auto-checked.

How do I map a drive to a virtual machine? ›

  1. Start Windows Explorer.
  2. Navigate to My Computer or Computer.
  3. Run the command to map a network drive. Option. Description. Windows Vista, Windows 7, Windows 8, Windows 10. Click Map Network Drive. ...
  4. Select a drive to map.
  5. In the Folder field, type \\vmware-host\Shared Folders\ .
  6. Click Finish.
May 31, 2019


1. Xen server 7 Installation
(Parth Patel)
2. Xencall Dialer Training
(Nica H)
3. The Automated Backup and Restore with XCP-NG & Xen Orchestra Is Amazing!
(Lawrence Systems)
4. Citrix XenServer 6 - Copying, Importing, Exporting, and Moving VMs
(Pluralsight IT - Training Archive)
5. XenServer - Your first Virtual Machine Install
(Chris Titus Tech)
6. Citrix Xenserver Local ISO Storage Repository
Top Articles
Latest Posts
Article information

Author: Frankie Dare

Last Updated: 04/16/2023

Views: 5675

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.