How to Utilise USB Devices with a VMware vSphere Virtual Machine

Subscribe banner

When using virtual machines, the principle of hardware virtualization is used and hypervisor software emulates devices used by VMs on the software level. Virtual controllers, disks, DVD-ROM, video card, network cards, input devices, and other devices are ordinarily created in a virtual machine. Sometimes you lot may need to connect a physical device to a virtual automobile directly. This device tin can be a printer, scanner, USB flash drive, USB hard disk drive, USB smart carte reader, security dongles, USB license keys, etc. If your external physical device has the USB interface, you can attach this device to a virtual car running on VMware Workstation and ESXi server. VMware allows yous to connect USB devices to virtual machines by using the USB passthrough feature (passing the device through). This blog mail service explains how to utilize this characteristic on ESXi hosts in VMware vSphere.

What Is USB Passthrough?

VMware USB device passthrough is a feature that allows you to connect a concrete USB device attached to a USB port of a physical ESXi server to a virtual machine as if the USB device was connected to a virtual motorcar straight. VMware passthrough is a characteristic available starting with ESXi 4.i.

Reasons vary for using passthrough for a USB device from the ESXi server to a guest operating system (OS) of a virtual machine. For example, you accept an onetime scanner or printer that doesn't have drivers for the latest Windows Bone versions. Y'all tin install the old Windows version supported by the USB device and connect this device to a virtual machine. Another use case of this characteristic is when you need to re-create files from/to a USB hard disk drive to/from a virtual machine directly with high speed. Information technology may happen that users need to apply software that is protected by hardware USB license keys on virtual machines.

How USB Passthrough Works

There are iii primary components required for USB passthrough functioning: the arbitrator, USB controller, and concrete USB device.

The arbitrator is a dedicated service on an ESXi server. The arbitrator scans physical USB devices attached to the physical server and is responsible for USB device traffic routing between a physical host and a virtual machine. Only 1 VM can access the USB device at a time. Access to the USB device connected to one VM is blocked for other VMs. The USB arbitrator supports up to 15 USB controllers (vSphere seven.0). The Arbitrator service is enabled on ESXi past default.

A USB controller used on a concrete ESXi server is the controller to which physical USB ports are connected. The physical USB controller works with concrete USB devices inserted into the physical USB ports of the server. USB controllers tin be onboard (they are likewise called integrated and are built-in on a chip in a motherboard) or external (implemented as PCI or PCIe cards that are inserted into the advisable slots on a motherboard of a server). The onboard USB controller acts as a bridge between a USB jitney and a PCIe (or PCI) bus. The onboard USB controller is physically continued by the appropriate number of PCIe lanes to a chipset on a motherboard.

A virtual USB controller is an emulated device created especially for a virtual motorcar running on a hypervisor. A virtual USB controller interacts with a physical USB controller when yous passthrough a physical USB device from a physical ESXi server to a invitee OS on the VM. Presence of a virtual USB controller in VM configuration is required to employ the USB passthrough feature on the VM. A maximum of viii virtual USB controllers can be connected to a VM on an ESXi host. If you demand to remove a virtual USB controller from a VM configuration, you have to remove all USB devices connected to that controller first. VMware USB commuter is installed in a guest OS after adding a virtual USB controller to VM configuration.

A concrete USB device is any USB device that has a USB interface and USB port for being continued to a computer. Maximum 20 USB devices can be connected to a single VM or ESXi host.

USB standards and controller modes are:

  • USB 2.0 and USB 1.1 (EHCI+UHCI)
  • USB 3.0 (xHCI) VM hardware version 8 or higher

After connecting a concrete USB device to a virtual auto past using the VMware USB passthrough characteristic, you lot may need to install drivers for the connected USB device in a guest operating system.

Requirements for USB 3.0

USB 3.0 is available for ESXi servers starting from VMware vSphere 5.5 patch 3. The xHCI USB controller is required in VM configuration for this purpose. Bone requirements to apply USB 3.0 passthrough are: Windows 8.1 or higher, Windows Server 2012 R2 or higher, or Linux with Linux kernel 2.6.35 or higher. USB 3.1 devices are supported on their maximum speed since VMware vSphere seven.0

Limitations for USB Passthrough

In that location are some limitations yous should know well-nigh before starting to use the USB passthrough characteristic:

  • A USB drive cannot exist used as a boot drive for a VM.
  • If a USB drive is used to boot ESXi, this USB drive cannot be attached to a VM.
  • Virtual hardware version 7 or higher is required for a VM.

Some USB devices tin be not supported by VMware:

  • USB hubs
  • Sound devices and video cameras that use asynchronous information transfer
  • Some USB keyboards and mice (y'all can find details in the VMware 1021345 article)
  • Some smart cards using CCID may need boosted tuning for connectedness to a VM

vMotion is possible for VMs with connected USB passthrough devices. After proper VM configuration and enabling vMotion, USB devices remain connected to the VM after migration to another ESXi host.

There are vMotion limitations for VMs that employ USB passthrough disks:

  • Distributed Power Management (DPM) is not supported because an ESXi host cannot be shut down for power saving without disconnecting a USB device from a VM (a USB device is disconnected if the host is powered off past DPM). DPM should be disabled on this host.
  • Fault Tolerance is not supported.
  • A VM cannot be suspended or powered off (otherwise USB devices are asunder from a VM and they can be reconnected just after migration of the VM to the initial ESXi server to which USB devices are physically connected). The VM must be manually migrated to the ESXi host with the attached USB device when you demand to power on this VM. Linux guests that were resumed can mount USB devices to different mountain points after reconnection.
  • ESXi hosts that take VMs with USB passthrough devices must exist attainable via the VM kernel interface vmk0 (for the management network) and TCP port 902.

Disconnect USB devices from a VM before using the hot-add characteristic and adding CPU, memory, or PCI devices. Otherwise USB devices are asunder automatically, and when you use the hot-add feature, some data tin be lost. If you suspend a VM and and then resume the VM, USB devices are disconnected and then reconnected to the VM again.

As for creating a VMware virtual USB drive or virtual flash bulldoze for attaching to a virtual machine running on ESXi or VMware Workstation, just like you would mount a virtual floppy disk or CD/DVD disc, currently this selection is not possible.

How to Connect a USB Device to a VM

At present that we take familiarized with the theory, we tin can become to the practical part and wait at configuration in VMware vSphere.

Insert a USB device into a USB port of your ESXi server. In my example, I'm going to insert a USB wink bulldoze.

You can check whether the USB device is continued to ESXi afterwards that in the ESXi command line interface

lsusb

As you tin can see on the screenshot beneath, my wink drive is now continued to the ESXi server.

VMware USB devices configuration

The USB arbitrator service must be running. You lot tin check the service condition with the control:

chkconfig usbarbitrator --listing

If the USB arbitrator is stopped, you can offset the USB arbitrator with the command:

/etc/init.d/usbarbitrator start

Read more about ESXiCLI in the blog mail.

The VM is residing on the ESXi host that is managed by vCenter Server in my case. Windows is installed as a guest OS on my VM. Open up VMware vSphere Client, become to Hosts and Clusters. In the Navigator pane select a virtual machine to which you want to connect the USB device past using the passthrough characteristic. The VM should exist in the powered-off state. You should install VMware Tools in the guest OS.

One time the VM is selected, click Actions > Edit settings.

Editing VM settings to connect USB drive to VMware virtual machine

In the Edit Settings window, cheque whether a USB controller is present in the VM configuration. If the USB controller is missing, click Add New Device > USB Controller, and select the USB controller type (USB 2.0 or USB 3.0).

If the USB controller is present, you lot should add the USB device that is attached to the ESXi server to your VM. Click Add together New Device > Host USB Device.

Adding a VMware USB device to a virtual machine

A new cord is added to the VM configuration. In the New USB Host device string, select ane USB device that you want to connect to the VM. At present I have two USB flash drives attached to my physical ESXi server, and I'g connecting the Verbatim Flash drive to my VM (Verbatim product 0x0302). If you need to enable vMotion support, expand New Host USB device, and select the "Support vMotion while device is continued" checkbox. Keep in heed vMotion requirements and limitations. Hitting OK to relieve the configuration and close this window.

VM USB configuration – selecting a USB device that should be connected to a VM

Start a virtual machine. Once the invitee Bone is loaded, await until the USB flash drive is initialized and installed. Then open Windows Device Manager. Right click My Calculator and, in the context carte, click Manage. In the Estimator Management Window, click Device Manager and expand the Deejay drives section (as we connect a USB flash bulldoze, this device should be displayed in this category of devices). We tin see Verbatim USB device, which is the name of my USB flash drive continued to the VM with the VMware USB Passthrough feature.

Open up Disk Management in the Calculator Management window, and make sure that a disk drive is assigned to the USB flash drive. In my instance, everything is right, and I can now copy information from the USB flash bulldoze to the virtual disk of a VM in guest Windows and vice versa.

ESXi USB passthrough is working and a USB drive is connected to a VM

VMware PCI Passthrough

If the USB device that you want to connect to a VM by using the VMware USB passthrough feature is not supported by VMware, you tin can try using the PCI passthrough feature and connecting the entire physical USB controller that has the PCI interface to a VM. If your ESXi server has a USB controller inserted into a PCI slot, you tin passthrough this PCI device to a virtual motorcar. VMware PCI passthrough is also called VMDirectPass. This method is less convenient than using USB passthrough merely can help you get the job done.

Requirements

Intel Directed I/O or AMD I/O Virtualization Engineering science (AMD IOMMU) must be supported past server hardware and enabled in UEFI/BIOS. If yous have only one USB controller in your server, yous should attach an additional USB controller to avert losing connections to USB devices used by your physical ESXi server.

Restrictions and limitations:

  • A VM cannot be suspended.
  • A VM cannot be migrated to other ESXi hosts with vMotion.
  • VM snapshots are not supported.

Permit's look at the workflow of connecting a USB device to a VM past using PCI passthrough and connecting the entire USB controller to which a USB device is connected to a VM.

In order to identify the USB device and USB controller to which your USB device is continued (if there are multiple USB controllers installed on your server) apply this control:

lsusb -five | grep -due east Bus -eastward iSerial

Find the string with the proper noun of your USB device continued to the USB controller and identify the id of the controller (for instance, bus002).

You can check the VMkernel log when connecting a USB device to an ESXi server.

tail -f /var/log/vmkernel.log | grep -i USB

Open up VMware vSphere Client, and go to Hosts and Clusters.

Select the ESXi host on which your VM (to which you lot need to connect a USB device) is residing.

Go to the Configure tab, then select PCI Devices in the Hardware section.

Discover and select the needed USB controller in the list of PCI devices by using the ID you lot accept detected before.

The status of the selected controller should now change to Available.

Hit OK to salvage settings.

Reboot the ESXi host for changes take outcome.

Make certain that your VM is powered off. Go to VM settings, click Add together New Device > PCI device > Add together. Select your USB controller in the dropdown carte by using the correct ID.

Ability On the VM. Cheque devices in the guest Bone. If Windows is installed on the VM, open up Device Manager, and so bank check controllers and storage devices.

Connecting USB Smart Cards

Some USB devices that accept the appropriate class of CCID may not be supported by default for connection to VMs. The error message "Cannot connect 'path:0/1/6/1' to this virtual machine. The device was non institute" is displayed. In logs, yous can meet the message:

(vmx-vcpu-0) did not claim interface 0 before use

PCSCD is the ESXi daemon that controls smart card readers. Access to USB smart cards is disabled for virtual machines to avert conflicts because a smart card needed by an ESXi server. Equally a result, you cannot use USB passthrough with default configuration for USB smart cards. You lot need to edit the configuration of the ESXi host to enable USB passthrough for USB smart cards.

Terminate the virtual machine. Open virtual machine settings, select the VM Options tab, and click Edit Configuration.

Editing VM options for VM USB smart card connection

In the Configuration Parameters window, click Add together Configuration Params.

Editing VM USB configuration for a USB smart card reader

Every bit an alternative, you tin edit the VMX configuration file of the virtual machine in the command line interface by connecting to ESXi panel with an SSH client.

Edit or add this line to the VM configuration if the parameter is not nowadays:

usb.generic.allowCCID = "Truthful"

Relieve VM configuration.

Cease the PCSCD service by using this command in the ESXi command line:

sudo /etc/init.d/pcscd stop

Brand sure that the PCSCD service is not running:

ps | grep pcscd

Power on the VM, and check devices to verify that the USB smart menu reader is now connected to the VM.

Conclusion

This blog mail service has covered ESXi USB passthrough, which is a useful feature supported by VMware vSphere. Y'all tin connect diverse devices fastened to USB ports of physical ESXi servers to virtual machines straight and use them in guest operating systems of VMs merely like you use these USB devices on regular physical computers. Y'all can even migrate virtual machines using external USB devices connected to the parent ESXi host with vMotion to another host. Despite some limitations, the VMware USB passthrough characteristic adds more capabilities and flexibility in unlike situations.

VMware VM backup is important for those who use VMware vSphere. Download the Gratis Edition of NAKIVO Backup & Replication and effort this universal data protection solution to protect your VMware vSphere VMs and other data in your environment.