USB Devices as VMFS Datastore in vSphere ESXi 6.0

In the last years I’ve seen many requests in forums and blogs where people are trying to use USB devices like USB sticks or external hard disks as VMFS formatted datastore. It was actually possible in vSphere 5, but very picky. Some USB flash drives were working, others not. In vSphere 6, this behavior has been changed obviously. This post explains how you can use USB devices as datastore on your ESXi host. Of course, this is neither a supported, nor a performant storage solution, so use at your own risk.

[Update: If you are looking for USB VMFS Datastores in vSphere 6.5, read this article.]

Create VMFS Datastore on USB drives

  1. Connect to the ESXi host with SSH
  2. Stop the USB arbitrator service. This service is used to passthrough USB device from an ESX/ESXi host to a virtual machine. (When disabling it, you can no longer passthrough USB devices to VMs)
    ~ # /etc/init.d/usbarbitrator stop
  3. (optional) Use this command to permanently disable the USB arbitrator service after reboot.
    ~ # chkconfig usbarbitrator off
  4. Plug in the USB Device to your ESXi host
  5. Get the device identifier (mpx.vmhbaXX). You should see the USB Device in /dev/disks/:
    ~ # ls /dev/disks/
  6. Write a GPT label to the device (Assuming that the Device ID is mpx.vmhba36)
    ~ # partedUtil mklabel /dev/disks/mpx.vmhba36\:C0\:T0\:L0 gpt
  7. To create a partition you need to know the start sector, end sector, which depends on the device size and the GUID.
    The start sector is always 2048
    The GUID for VMFS is AA31E02A400F11DB9590000C2911D1B8
    The end sector can be calculated with the following formula (Use the numbers from getptbl):

    ~ # partedUtil getptbl /dev/disks/mpx.vmhba36\:C0\:T0\:L0
    1947 255 63 31293440

    1947 * 255 * 63 – 1 = 31278554

    You can also calculate the endsector with the following command:

    ~ # eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba36\:C0\:T0\:L0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
  8. Create the VMFS partition (Replace with your endsector)
    ~ # partedUtil setptbl /dev/disks/mpx.vmhba36\:C0\:T0\:L0 gpt "1 2048 31278554 AA31E02A400F11DB9590000C2911D1B8 0"
    Note: Cara Cek GUID
    partedUtil showGuids

    which results in the following output.

    [root@e2esx03:~] partedUtil showGuids
    Partition Type GUID
    vmfs AA31E02A400F11DB9590000C2911D1B8
    vmkDiagnostic 9D27538040AD11DBBF97000C2911D1B8
    vsan 381CFCCC728811E092EE000C2911D0B2
    virsto 77719A0CA4A011E3A47E000C29745A24
    VMware Reserved 9198EFFC31C011DB8F78000C2911D1B8
    Basic Data EBD0A0A2B9E5443387C068B6B72699C7
    Linux Swap 0657FD6DA4AB43C484E50933C84B4F4F
    Linux Lvm E6D6D379F50744C2A23C238F2A3DF928
    Linux Raid A19D880F05FC4D3BA006743F0F84911E
    Efi System C12A7328F81F11D2BA4B00A0C93EC93B
    Microsoft Reserved E3C9E3160B5C4DB8817DF92DF00215AE
    Unused Entry 00000000000000000000000000000000


  9. Format the partition with VMFS5
    ~ # vmkfstools -C vmfs5 -S USB-Stick /dev/disks/mpx.vmhba36\:C0\:T0\:L0:1

The USB-Stick should now appear in your datastores view.

And the final proof is a virtual machine running on it:

This is how your command output should look like:

~ # partedUtil mklabel /dev/disks/mpx.vmhba43\:C0\:T0\:L0 gpt
~ # eval expr $(partedUtil getptbl /dev/disks/mpx.vmhba43\:C0\:T0\:L0 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
~ # partedUtil setptbl /dev/disks/mpx.vmhba43\:C0\:T0\:L0 gpt "1 2048 31278554 AA31E02A400F11DB9590000C2911D1B8 0"
0 0 0 0
1 2048 31278554 AA31E02A400F11DB9590000C2911D1B8 0
~ # vmkfstools -C vmfs5 -S USB-Stick /dev/disks/mpx.vmhba43\:C0\:T0\:L0:1
create fs deviceName:'/dev/disks/mpx.vmhba43:C0:T0:L0:1', fsShortName:'vmfs5', fsName:'USB-Stick'
deviceFullPath:/dev/disks/mpx.vmhba43:C0:T0:L0:1 deviceFile:mpx.vmhba43:C0:T0:L0:1
ATS on device /dev/disks/mpx.vmhba43: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 vmfs5 file system on "mpx.vmhba43:C0:T0:L0:1" with blockSize 1048576 and volume label "USB-Stick".
Successfully created new volume: 56226b60-118f2e3f-04ba-001b2193b3b0
Posted on: November 26, 2022, by :  | 10 views