Configuring a vSphere ESXi host to use a local USB device for VMFS volume

To use a local USB storage device for VMFS volume:

Validate that no virtual machines are using USB devices via passthrough, disable the USB Arbitrator service using the command.

~] /etc/init.d/usbarbitrator stop
watchdog-usbarbitrator[3153573]: Terminating watchdog process with PID 2098512
stopping usbarbitrator...
usbarbitrator stopped

~] esxcli storage core adapter rescan -a

~] esxcli storage core adapter list
HBA Name Driver Link State UID Capabilities Description
-------- ---------- ---------- ------------------------------------ ------------------- -----------
vmhba0 lsi_mr3 link-n/a sas.54cd98f0086ec300 (0000:03:00.0) Broadcom PERC H330 Mini
vmhba1 vmw_ahci link-n/a sata.vmhba1 (0000:00:1f.2) Intel Corporation Wellsburg AHCI Controller
vmhba2 vmw_ahci link-n/a sata.vmhba2 (0000:00:11.4) Intel Corporation Wellsburg AHCI Controller
vmhba3 qlnativefc link-down fc.20000024ff921eaa:21000024ff921eaa Second Level Lun ID (0000:05:00.0) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA
vmhba4 qlnativefc link-down fc.20000024ff921eab:21000024ff921eab Second Level Lun ID (0000:05:00.1) QLogic Corp ISP2532-based 8Gb Fibre Channel to PCI Express HBA
vmhba34 vmkusb link-n/a usb.vmhba34 () USB

~] ls /dev/disks/
mpx.vmhba34:C0:T0:L0 vml.0100000000333235354537313738303233303332584449534b20
mpx.vmhba34:C0:T0:L0:1 vml.0100000000333235354537313738303233303332584449534b20:1

~] partedUtil delete /dev/disks/mpx.vmhba34:C0:T0:L0 1

~] partedUtil mklabel /dev/disks/mpx.vmhba34:C0:T0:L0 gpt

~] partedUtil getptbl /dev/disks/mpx.vmhba34:C0:T0:L0
gpt
31130 255 63 500118192

~] eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba34:C0:T0:L0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
500103449

~] partedUtil setptbl /dev/disks/mpx.vmhba34:C0:T0:L0 gpt "1 2048 500103449 AA31E02A400F11DB9590000C2911D1B8 0"

~] partedUtil getptbl /dev/disks/mpx.vmhba34:C0:T0:L0
gpt
31130 255 63 500118192
1 2048 500103449 AA31E02A400F11DB9590000C2911D1B8 vmfs 0

~] vmkfstools -C vmfs6 -S USB_Datastore /dev/disks/mpx.vmhba34:C0:T0:L0:1
create fs deviceName:'/dev/disks/mpx.vmhba34:C0:T0:L0:1', fsShortName:'vmfs6', fsName:'USB_Datastore'
deviceFullPath:/dev/disks/mpx.vmhba34:C0:T0:L0:1 deviceFile:mpx.vmhba34:C0:T0:L0:1
ATS on device /dev/disks/mpx.vmhba34:C0:T0:L0:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs6 file system on "mpx.vmhba34:C0:T0:L0:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "USB_Datastore".
Successfully created new volume: 662db00c-ca962019-d624-20040fef52e0

To restore USB device access for passthrough to virtual machines without restarting:

Detach a USB device from ESXi hosts.

~] esxcli storage filesystem list
Mount Point Volume Name UUID Mounted Type Size Free
------------------------------------------------- ------------------------------------------ ----------------------------------- ------- ------ ------------- ------------
/vmfs/volumes/662db00c-ca962019-d624-20040fef52e0 USB_Datastore 662db00c-ca962019-d624-20040fef52e0 true VMFS-6 255818989568 150051225600

~] esxcli storage filesystem unmount -u 662db00c-ca962019-d624-20040fef52e0

Validate that the VMkernel is not using any USB devices, enable the USB arbitrator service using the command.

/etc/init.d/usbarbitrator start

Restart the ESXi host daemon and vCenter Agent services using these commands.

/etc/init.d/hostd restart
/etc/init.d/vpxa restart