Boot ESXi Virtual Machine From Passthrough USB

0

Recently, in playing around with the home lab environment, I had the need to boot a virtual machine from a USB thumbdrive that was attached to one of my ESXi hosts in the lab. Using a devie that is attached to the physical ESXi host is known as “passthrough” or passing the device through to the guest virtual machine. This opens up a wide range of use cases and possibilities with physical devices that can be connected to the ESXi host. However, if you have ever tried to boot a virtual machine from a USB passthrough device connected to an ESXi host, you may have run into challenges doing this as I did. Let’s take a look at how to boot esxi virtual machine from passthrough USB.

USB Passthrough Features and Limitations

VMware has a really good KB article that covers USB support in the various ESXi versions. There are several things to note from this KB article.

USB device passthrough requires:

  • You need VM version 7 or higher
  • A USB controller
  • A USB device or device hub
  • Formatting of the USB drive should be ext3 or FAT32

Types of USB Passthrough available:

Host-Connected:  The type of passthrough for USB that has been around the longest, and allows a USB device plugged directly into the ESXi/ESX host to be passed through to a virtual machine.  This is the type of USB passthrough I am working with on the guest virtual machine.

Client-Connected: This feature became available with the release of vSphere 5.0, and allows a USB device plugged into a user’s workstation to be passed through to a virtual machine via the vSphere Client.

Types of USB Controllers available:

  • EHCI+UHCI controller: This is the classic USB controller allowing the usage of USB 2.0 and USB 1.1 devices.
  • xHCI controller: This is the newer controller type allowing the usage of faster USB 3.0 devices. Virtual hardware version 8 is required to use this controller.

USB devices have these limitations:

  • A VM can have no more than 20 USB devices attached to it, however each unique USB device can only be attached to one virtual machine at a time.
  • USB devices that are unsupported, may not interact as expected with other ESXi/ESX features. 
  • Before you hot add memory, CPU, or PCI devices, you must remove any USB devices. Hot adding these resources disconnects USB devices, which may result in data loss.
  • When you suspend and resume a virtual machine, USB devices behave as if they have been disconnected, then reconnected.
  • The virtual machine cannot boot from the attached USB device.

Boot ESXi Virtual Machine From Passthrough USB

You may ask, in this day and age of ISO images and other means to boot virtual machines, why would you have a need to boot a guest virtual machine from a USB passthrough device?

Recently, I had a vendor formatted USB disk that I could not image out to an ISO image and needed to boot from the physical USB disk that was created using a vendor provided utility.

There may be other use cases out there and I am sure this is going to be a corner case for most, as in this day and time the boot challenge has largely been won with the number and variety of utilities out there.

First off, how is USB passthrough enabled? It is a fairly simple process in the vSphere client. After plugging the physical USB key into the ESXi host, edit the settings of the VM and choose Add New Device > Host USB Device.

Adding-a-USB-passthrough-device-to-an-ESXi-6.7-host Boot ESXi Virtual Machine From Passthrough USB
Adding a USB passthrough device to an ESXi 6.7 host

The New Host USB device will display the available devices in a dropdown menu if you have more than one. The red highlight around the Cyber Power System device is because this USB device is already connected to another VM. The device I want to choose is the Kingston DTR30G2.

Selecting-the-USB-device-connected-to-the-ESXi-host-that-you-want-to-passthrough Boot ESXi Virtual Machine From Passthrough USB
Selecting the USB device connected to the ESXi host that you want to passthrough

The device is now added to the virtual machine as shown below.

USB-Passthrough-device-is-successfully-added-to-the-ESXi-host Boot ESXi Virtual Machine From Passthrough USB
USB Passthrough device is successfully added to the ESXi host
Attempting-to-boot-off-removable-devices-with-USB-passthrough-enabled Boot ESXi Virtual Machine From Passthrough USB
Attempting to boot off removable devices with USB passthrough enabled
The-USB-disk-is-simply-skipped-and-the-normal-boot-order-is-attempted Boot ESXi Virtual Machine From Passthrough USB
The USB disk is simply skipped and the normal boot order is attempted

Is there a way to be able to boot from these “unsupported” USB passthrough disks? Well, a great way that I stumbled onto via some Googling is the plpbt Boot Manager software.

The premise is simple. You boot from an ISO image file (plpbt Boot Manager) and then with the boot manager, you choose your USB disk and it will allow booting from the passthrough USB disk. Below, a screenshot from after booting from the plpbt Boot Manager utility. You have simple options here. Select the USB option to boot from USB.

Booted-from-the-plpbt-Boot-manager-utility Boot ESXi Virtual Machine From Passthrough USB
Booted from the plpbt Boot manager utility

If plpbt Boot Manager runs into issues booting from the USB drive, you will see an error like below. Below, I saw the boot from USB error out when I had a USB 3.0 controller attached to the VM. After swapping this out with a USB 2.0 virtual controller, the boot process worked. I am not sure if this is a limitation with plpbt or with the hardware I was working with in the lab environment as the USB drive was a 3.0 drive.

Issue-booting-from-the-USB-device-from-plpbt-Boot-Manager Boot ESXi Virtual Machine From Passthrough USB
Issue booting from the USB device from plpbt Boot Manager

After changing out the USB controller on the virtual machine, the VM was able to boot into the live environment directly from the USB passthrough device connected to the ESXi host. Cool!

Virtual-Machine-guest-booted-from-the-USB-passthrough-disk Boot ESXi Virtual Machine From Passthrough USB
Virtual Machine guest booted from the USB passthrough disk

Takeaways

You may not have the need to boot from a USB passthrough disk except with certain corner cases with booting guest VMs. However, this is not supported by default with the USB passthrough default behavior and functionality. With plpbt Boot Loader, this can easily be accomplished where you can boot from a USB drive that is passed through from the host. Cheers!