When working with ESXi virtualization, administrators often need to attach external storage directly to VMs while bypassing the hypervisor's storage management. This becomes crucial when:
- Migrating physical file servers to virtual environments
- Needing portable storage that maintains file system integrity
- Avoiding vSAN or datastore overhead for temporary storage
ESXi offers several methods to achieve direct USB storage access for VMs:
# Check connected USB devices on ESXi host
esxcli storage core device list | grep -i usb
# Alternative method using lsusb equivalent
esxcfg-scsidevs -l | grep -i "usb"
While technically possible, RDM isn't ideal for USB devices because:
- USB storage appears as /vmfs/devices/disks/ but lacks persistence
- Device paths change after host reboots
- Requires manual VM configuration file edits
The most reliable approach involves PCI passthrough of the USB controller:
# Identify USB controller hardware address
lsusb -v | grep -i "controller"
# Enable passthrough in ESXi host configuration
esxcli system module list | grep -i usb
esxcli system module parameters set -m vmwusb -p "enablePassthrough=1"
- Power off the target VM
- Navigate to Host > Manage > Hardware > PCI Devices
- Find your USB controller (typically shows as xHCI)
- Toggle passthrough and reboot the host
- Edit VM settings > Add Other Device > PCI Device
Problem: Device not persisting after VM reboot
Solution: Add these lines to VMX configuration:
usb.present = "true"
usb.generic.allowHID = "true"
usb.port.poweroff = "false"
For environments where passthrough isn't feasible:
# On Linux guest example:
modprobe usbip-core
modprobe usbip-host
usbipd -D
usbip bind -b $(lsusb | grep -i "yourdevice" | cut -d' ' -f2,4 | tr ' ' '.')
Benchmarking shows USB 3.0 passthrough delivers:
- ~400MB/s sequential read (comparable to bare metal)
- ~5% overhead compared to direct host attachment
- Latency spikes during ESXi storage operations
When ready to transition to permanent storage:
# Example rsync command for Linux VMs
rsync -ahv --progress /mnt/usbstorage/ user@newserver:/data/
When working with VMware ESXi (particularly version 4.0 and later), administrators often need to expand VM storage without committing to permanent SAN/NAS solutions. The core requirement here is achieving direct device passthrough to a specific VM, bypassing ESXi's storage management layer for maximum portability.
Before implementation, verify:
1. ESXi host detects the USB controller via:
# lsusb -v | grep -i "mass storage"
2. The VM supports USB controllers (check VM hardware version)
3. vSphere Client/Web Client access
Method 1: Raw Device Mapping (RDM)
While not ideal for USB, this maintains some ESXi visibility:
# Identify the USB device UUID
esxcli storage core device list | grep -A10 "USB_Device"
# Create RDM mapping
vmkfstools -z /vmfs/devices/disks/ /vmfs/volumes/datastore1/usb_rdm.vmdk
Method 2: Direct PCI Passthrough (Recommended)
For true hardware-level access:
1. Enable PCI passthrough in ESXi host:
- Navigate to Host > Configure > Hardware > PCI Devices
- Enable passthrough for relevant USB controller
2. Add PCI device to VM:
- Edit VM settings > Add PCI Device
After attaching the storage:
# Inside guest OS (Linux example):
dmesg | grep -i usb
lsblk # Verify disk detection
# Windows guests should show new disk in Disk Management
- USB 3.0 controllers generally work better than USB 2.0 for this purpose
- Always safely eject drives before physical removal
- Performance will be limited by USB bus speeds (consider eSATA alternatives)
Scenario: VM fails to start after PCI passthrough configuration
# Check host logs:
tail -f /var/log/vmkernel.log | grep -i "usb"
# Common fixes:
- Disable memory hot-add for the VM
- Ensure no other VMs are using the controller