Virtualization is the current trend due to its several beneficial features. Of all, the most commendable one is the abstraction of storage, computing, and networking resources. This means you can configure a virtual version of your hardware units such as disk, memory, and CPU, as any operating system needs them.
You can easily share these resources even on those systems that are not a part of your virtualized network. However, a few hardware parts pose a challenge to be a part of virtualization, as they are not shared, not even among the independent applications. USB devices belong to this group.
The major reason for this is that they are designed to communicate with just one application or a subsystem at a time. The users of virtual machines, thus, face difficulties while connecting to these devices in a virtualized environment. To resolve this issue, there is a USB passthrough.
So, what is a USB passthrough? Let’s learn about it in detail in this post.
Introduction to USB Device Passthrough
Although users of virtual machines do not think of physical devices, there are spells when they feel the need to make them interact with the guest operating system of their virtual machines. A USB storage device is one of the most common types of such devices.
Well, there is a method to attach these devices to a virtualized guest OS running on top of a hypervisor or a virtualization software application. This is called a USB passthrough. It passes a physical USB device from the hypervisor host to the guest OS on a virtual machine.
In other words, a hypervisor host can pass-through devices from the host to the guest OS. Thanks to this you can connect physical hardware from inside the virtual machine. The drivers of a guest OS can use the device hardware independently; there is no need to depend on the drivers of the host OS.
There are a couple of reasons why you will use passthrough to make a USB device available to a guest OS. You may have to read or write documents to a USB device from inside a guest OS in a virtual machine. You may have a requirement of giving licensing details to vendor-specific software executing on the virtual machine.
A USB device passthrough is also available in some keyboards that have more than one USB port. USB passthrough needs at least two USB ports in the keyboard for passing the USB to the PC, usually using an extra connection for ports.
General Working of USB Passthrough
There are three components that make USB passthrough possible for connecting a USB device to a virtual software host such as the ESXi host of VMware. Well, this is likely to vary as per the virtual software in use. They are as follows:
- Physical USB Device: Is the obvious one. You need a physical one to pass through to the virtual machine. In most scenarios, only 20 USB devices can work with a virtual machine. This number also marks the maximum devices that can connect to a single virtual software host.
- Arbitrator: Is an entity that handles connection requests and directs the traffic from a USB device. By default, it is installed and activated on the host itself. An arbitrator scans for physical USB devices after which it manages their connections with the virtual machines. It precisely routes the device traffic to the virtual machine to which the device is connected. At the same time, it does not allow any other virtual machine to use the device while a specific virtual machine is communicating with it.
- Controller: Is an entity in software as well as hardware version. The host itself needs a physical USB device controller for enabling USB connection as well as communication. A virtual controller is a software counterpart and virtualizes the operations of the host controller. For each virtual machine, there are only eight USB controllers. It is essential to install the virtual hardware controller on the virtual machine, prior to passing a USB device to a virtual machine from the host.
USB Passthrough on Hyper-V
Hyper-V refers to a virtualization software that allows running more than one operating system on your Windows 10 o Linux computer. Yes, it allows making different virtual machines on your computer. It is built into this OS as an optional feature, which you need to enable using the Command Prompt or PowerShell.
Each guest OS made using the Hyper-V platform can directly use the physical server’s hardware such as memory, hard drive, and processor. While it is convenient, there is one inconvenient aspect of the Hyper-V virtualization environment. It does not inherently support USB passthrough.
In other words, you cannot access or USB devices attached to your local computer while operating a Hyper-V virtual machine. Well, this virtualization software is a type-1 hypervisor, meaning an instance of an operating system does not allow a USB port to be accessed by other OS instances. The instance simply locks the port.
Thus, you will be unable to allow a USB port to a specific guest. Luckily, there are a few ways to make Hyper-V support USB passthrough.
If you know about VMware, you might be aware that enabling USB passthrough in it is simple. However, the main issue with it is that it is impossible to connect a USB device such as a pen drive to more than one virtual machine at once. Well, this is not the case with Hyper-V. The process of passing through a USB device in Hyper-V is a little different.
The USB drive can either be plugged into the Hyper-V host or attached to the PC or laptop from which you access the virtual machine. These two possibilities give rise to two distinct methods of doing the passthrough. Let’s explore them.
Server-side or Host-Level Hyper-V USB Passthrough
This USB passthrough is for the USB attached to the Hyper-V host. Instead of keeping permanently attached to the host, it is highly recommended to use USB storage only for occasional data or file transfer.
The process of making a host-connected USB device available to a virtual machine made by Hyper-V may not be as smooth as on VMware but it is not hard too. So, let’s just go through the procedure.
Ensure that a USB drive is attached to the Hyper-V server. Currently, the operating system of the host recognizes the storage drive. Now here, the issue is that only this OS can directly access the USB media. Thus, you first need to take it offline for making it unavailable to the host OS so that the targeted virtual machine can then access it.
To take it offline, open the Disk Management console by entering diskmgmt.msc at the server’s Run dialog box. Now, locate your USB disk, right-click it and not on the drive letter or volume, and select Offline from the context menu. This will take the disk offline.
Note: Alas, the console will not show the Offline option for all USB devices. For example, it will not show for a truly small USB device. In that case, you cannot implement USB passthrough.
Once the USB device is offline, go to the Hyper-V Manager, open the context menu of the virtual machine to which the USB device should connect, and select Settings. This shows the Settings window in which you now add SCSI Controller and an appropriate hard disk option. On the next screen, select your USB device from the Physical hard disk drop-down menu.
The USB device is now accessible through the virtual machine. In case it is not listed in the virtual machine, you would have to assign a drive letter to the device in the Disk Management console.
Client-side Hyper-V USB Passthrough
How will you access the USB drive attached to a client device? Well, there are two ways for this USB passthrough. The first way involves using the Remote Desktop Connection (RDC) utility on the virtual machine running Windows 10 so that remote connections are allowed on it. You go to Control Panel System and Security Allow Remote Access and tick two options starting with Allow.
Now, you need to remotely connect to this virtual machine. To do so, enter mstsc.exe in the Run prompt to open RDP client, expand Show Options, select the Local Resources tab, click More, check Other supported Plug and Play devices, click OK, and click Connect to activate a remote session.
The second way involves using the Enhanced Session Mode, a utility that redirects local devices and resources to a virtual machine. The mode is enabled by default on Windows 8.1 and 10 on which the Hyper-V host is running. In the case of Windows Server 2012 or 2016, you need to enable it.
To use the Enhanced Session mode, open Hyper-V Manager on the Hyper-V host, right-click the targeted virtual machine to be used and select Hyper-V Settings. The settings window opens wherein you select Enhanced Sessions Mode from both Server and User nodes one by one and ensure that the Allow enhanced session mode is checked.
Now, you select the local resources that you wish to use. For this, you double-click the virtual machine using the Hyper-V Manager window, click Show Options, select Local Resources, click More, and check Other Supported Plug and Play devices so that the virtual machine can access a local USB drive. Lastly, click Connect for logging into the virtual machine.
USB Passthrough on VirtualBox (vbox)
VirtualBox from Oracle is another popular hypervisor for virtualizing x86 computers. However, it is an open-source software unlike Hyper-V for making virtual machines on desktop computers. If you try plugging a USB device into a virtual machine made by VirtualBox, it will surely not get recognized?
This common issue is mainly due to the fact that the plug-n-play functionality of VirtualBox does not work effectively all the time and that Windows fails to find the right driver for the USB device. However, this is not acceptable, as it is important for you to access the USB drive from VirtualBox.
For example, you have installed Linux on VirtualBox and wish to perform testing via a USB network adapter. In that case, you can allow VirtualBox USB passthrough by simply tweaking its settings. You can do the same for accessing a USB hard disk or a USB thumb drive on your VirtualBox guest OS.
To ensure that the mounted USB device operates well, you need to install guest additions on the intended virtual machine. This is easy to do by running the virtual machine and selecting Device Install Guest Additions from the host window. The virtualization software will load a virtual disk with the additions. In case it does not happen, just launch the installer by going into the virtual disk.
Once this is done, in the VirtualBox Manager, right-click the virtual machine with which you intend to use the USB device. In the displayed Settings window, select USB from the left pane and click Add in the right pane. Now, from the displayed list, select the intended USB device and click OK to exit.
Now, in the virtual machine window, go to Device USB Devices and select the USB device that you just added. The device will now show itself on your physical computer. That’s it! You added the USB device to your vbox virtual machine. This is how vbox USB passthrough happens.
Still, the device is not seen? In that case, you should install the VirtualBox Extension Pack from the Oracle website, which should be of the same version as VirtualBox, and run it so that VirtualBox can automatically add it.
By default, VirtualBox supports only USB 1.x devices. However, the extension pack supports 2.0 and 3.0 devices too. You must install the extension pack with the same version as your installed version of VirtualBox. You now need to add yourself as a user to the vboxusers group, enable the USB controller, and then access the USB from VirtualBox.
Finally, you need to reboot the virtual machine so that the USB device can work.
USB Passthrough on a Keyboard
Have you seen a keyboard with two USB ports? Well, such a keyboard is designed for USB passthrough. Through these USB passthrough ports, you can plug a mouse, microphone, speakers, external hard drive, headset, thumb drive, or any other USB device.
Mostly upscale gaming keyboards allow USB passthrough. Keyboards with the USB passthrough facility come with an additional female USB port on the side, into which you can insert a USB device. Such USB passthrough is easier to perform for USB devices having a shorter cable.
For example, for playing a game, it is a breeze to plug a standing microphone directly into such a keyboard. For those who do not wish to reach the PC, it is wise to simply insert a thumb drive. Such a USB passthrough is super handy.
You will need two USB power cables (males) for taking the benefit of the USB passthrough facility in your keyboard. One of them will power the keyboard, while the other will power the passthrough port for working with an external USB device.
If the computer has no space for an extra USB port, just one USB port is enough to power the keyboard. However, doing so will not allow you to use USB passthrough on the keyboard.
A few keyboards also allow auxiliary passthrough. This is required to insert speakers into the keyboard rather than into the PC. The notion is identical to USB passthrough but it includes the use of an auxiliary cable. It is known as the auxiliary passthrough. It’s less popular than USB passthrough despite being equally convenient as well as useful.
Are there any mechanical keyboard with USB passthrough?
Yes! You can easily find a mechanical keyboard with a USB passthrough such as Logitech G512 and Corsair K70. However, before investing in one such keyboard, it is essential for you to know that USB passthrough on keyboards is not made for all users.
It has its pros and cons due to which not all will prefer having such a keyboard. The biggest benefit is its convenience, as it is a breeze to plug in extra USB devices. There is also no need to shift to another spot for using connected devices. Further, USB passthrough keyboards aid with cable routing so that your desk appears cleaner. After all, there is then no need to route the cables up to the computer.
On the flip side, such keyboards are more difficult to move around. This is because their power cables will be non-detachable. Due to such cables, you find it harder to pack the keyboard and carry it on the go. Moreover, it is hard to repair or replace such fixed cables. Thus, if your keyboard is damaged, you may have to replace it with another one.
USB passthrough is the ability to use a USB device on a guest virtual machine. It eases the challenges of using USB devices in the virtual environment. Apart from virtualization software applications, even keyboards support the USB device passthrough.