Configure VMFS filesystem on USB disk and mount it as datastore on ESXi host

From Notes_Wiki

Home > VMWare platform > VMWare vSphere or ESXi > Configure VMFS filesystem on USB disk and mount it as datastore on ESXi host

To configure a USB based disk as datastore to store VMs or other ESXi files use following steps:

  1. Start SSH service on ESXi host if not started already
  2. Connect to ESXi host over SSH
  3. Stop and disable USB arbitrator service using:
    /etc/init.d/usbarbitrator stop
    chkconfig usbarbitrator off
    usbarbitrator is required if we want to Raw Device Mapping (RDM) and map a USB connected to ESXi host to a VM. We cannot do both map a USB to VM and use USB as datastore on ESXi at the same time. Only one of the two is possible.
  4. Get the list of device names:
    ls /dev/disks/ #OR
    vdq -q
    Same should also be available when we open ESXi host via web UI (Storage -> Devices)
    Copy the device name of USB disk (naa.* or mpx.*) to some temporary location (eg Text file)
    Example output
    {
    "Name"  : "mpx.vmhba32:C0:T0:L0",
    "VSANUUID" : "",
    "State"  : "Ineligible for use by VSAN",
    "Reason"  : "Has partitions",
    "IsSSD"  : "0",
    "IsCapacityFlash": "0",
    "IsPDL"  : "0",
    "Size(MB)" : "1907729",
    "FormatType" : "512n",
    "IsVsanDirectDisk" : "0",
    },
  5. Create gpt partition table (label) on recognized disk using:
    partedUtil mklabel /dev/disks/<disk-device-name> gpt
    Example 'partedUtil mklabel /dev/disks/mpx.vmhba32:C0:T0:L0 gpt'
  6. Once partition table is created we can create partition for that to figure out end sector use:
    partedUtil getptbl /dev/disks/<disk-device-name>
    From output take the last value and subtract 2048. For example if output is:
    gpt
    243201 255 63 3907029168
    The calculation would lead to last sector being = 3907029168 - 2048 = 3907027120
    All the reference links below are wrong. Please see VMWare official KB on partedUtil getptbl command at https://kb.vmware.com/s/article/1036609 We should subtract 2048 from the last value shown by the command.
  7. Get the GUID of VMFS datastore using:
    partedUtil showGuids
    It should be 'AA31E02A400F11DB9590000C2911D1B8'
  8. Create partition using command:
    partedUtil setptbl /dev/disks/<disk-device-name> gpt "1 2048 <end-sector> AA31E02A400F11DB9590000C2911D1B8 0"
    Example 'partedUtil setptbl /dev/disks/mpx.vmhba32:C0:T0:L0 gpt "1 2048 3907027120 AA31E02A400F11DB9590000C2911D1B8 0"'
  9. Format the USB file-system and give it desired name using:
    vmkfstools -C vmfs6 -S <name> /dev/disks/<deviceID>:1
    For example 'vmkfstools -C vmfs6 -S USB-2TB-SSD-datastore /dev/disks/mpx.vmhba32:C0:T0:L0:1'
  10. The datastore should now be visible in web UI. You can also see it mounted under /vmfs/volumes


Note that there is comment about large drives (>2TB) not working on ESXi 6.5 in first reference link.


Refer:



Connecting USB with existing VMFS datastore to ESXi host

It is possible that USB with existing VMFS datastore is not getting recognized in ESXi host automatically. In that case use:

  1. Get the name of USB disk which is getting recognized erroneously as snapshot:
    esxcli storage vmfs snapshot list
    Example output
    583b1a72-ade01532-55f6-f44d30649051
    Volume Name: usbflash
    VMFS UUID: 583b1a72-ade01532-55f6-f44d30649051
    Can mount: true
    Reason for un-mountability:
    Can resignature: true
    Reason for non-resignaturability:
    Unresolved Extent Count: 1
  2. Use the VMFS UUID to mount the datastore:
    esxcli storage vmfs snapshot mount -u <uuid>
    For example
    esxcli storage vmfs snapshot mount -u 583b1a72-ade01532-55f6-f44d30649051

Refer:


Home > VMWare platform > VMWare vSphere or ESXi > Configure VMFS filesystem on USB disk and mount it as datastore on ESXi host