ehowton (ehowton) wrote,
ehowton
ehowton

Adding A USB Datastore to ESXi

Originally posted by fgrehk @ Virten.net

Connect to the ESXi host with SSH
###########################################################################################################################
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
-------------------------------------------
###########################################################################################################################
(optional) Use this command to permanently disable the USB arbitrator service after reboot.
-------------------------------------------
# chkconfig usbarbitrator off
-------------------------------------------
###########################################################################################################################
Plug in the USB device to your ESXi host. While connecting the USB device you can either watch /var/log/vmkernel.log
to identify the device name or identify it within /dev/disks. Devices are either named mpx.vmhbaXX or with an naa.X number.
-------------------------------------------
# ls /dev/disks/
-------------------------------------------
###########################################################################################################################
Write a GPT label to the device (Assuming that the Device ID is naa.5000000000000001)
--------------------------------------------------------
# partedUtil mklabel /dev/disks/naa.5000000000000001 gpt
--------------------------------------------------------
###########################################################################################################################
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/naa.5000000000000001
-----------------------------------------------------
gpt
15566 255 63 250069680
15566 * 255 * 63 - 1 = 250067789 (Your end sector)
###########################################################################################################################
You can also calculate the end sector with the following command:
------------------------------------------------------------------------------------------------------------------------
# eval expr $(partedUtil getptbl /dev/disks/naa.5000000000000001 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
------------------------------------------------------------------------------------------------------------------------
250067789 => Your end sector
###########################################################################################################################
Create the VMFS partition (Replace with your end sector)
--------------------------------------------------------------------------------------------------------------
# partedUtil setptbl /dev/disks/naa.5000000000000001 gpt "1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0"
--------------------------------------------------------------------------------------------------------------
###########################################################################################################################
Format the partition with VMFS5 or VMFS6
VMFS v5
-------------------------------------------------------------------------
# vmkfstools -C vmfs5 -S USB-Datastore /dev/disks/naa.5000000000000001:1
-------------------------------------------------------------------------
VMFS v6
-------------------------------------------------------------------------
# vmkfstools -C vmfs6 -S USB-Datastore /dev/disks/naa.5000000000000001:1

NOW DO THIS:

esxcli system settings advanced set -o /Disk/AllowUsbClaimedAsSSD -I 1
esxcli storage nmp satp rule add -s VMW_SATP_LOCAL --device=mpx.vmhba32:C0:T0:L0 --option=enable_ssd
esxcli storage core claiming unclaim --type device --device=mpx.vmhba32:C0:T0:L0
esxcli storage core claimrule load
esxcli storage core claimrule run

REMEMBER TO:

In the vSphere Client, navigate to the ESXi host.
Click the Configure tab.
Under System, click Advanced System Settings.
In the Advanced System Settings table, select the Misc.APDTimeout parameter and click the Edit icon.
I've been using 600 as the value.
Tags: linux, vmware
Subscribe

  • Why A Cosmic Artisan?

    Visiting with my kids over Father’s Day, things eventually turned philosophical as they often do, and as we were discussing the vastness of the…

  • Playing the Game

    Global Chat and Online Forums are a wondrous, yet frightening thing; you can learn so many new ideas, helpful hints, and gain previously unthought…

  • Don't Be A Sea Cucumber

    When you have a strong opinion about something but never questioned why you hold it, where it came from, or the circumstances surrounding how it…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments