Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dunderrrrrr/6e5aed2aba8a7162e3d993215bdb30ae to your computer and use it in GitHub Desktop.
Save dunderrrrrr/6e5aed2aba8a7162e3d993215bdb30ae to your computer and use it in GitHub Desktop.

SSH

First, enable SSH on your ESXi host (if not already enabled).
Connect to ESXi IP address, go to Actions and then select Services and Enable Secure Shell (SSH).

USB Arb. Service

You have to stop USB Arbitrator Service. The service is used to passthrough the USB devices from hosts to a virtual machine. Once stopped, you will not be able anymore to passthrough USB devices to VMs.

# /etc/init.d/usbarbitrator stop 

To maintain the stopped status of the service after reboot, insert the command:

# chkconfig usbarbitrator off 

Plug in the USB device to the ESXi host and get the device identifier.

# ls /dev/disks/ 

Find the identifier (tricky part), mine is called mpx.vmhba33:C0:T0:L0.

Write a label to the device

# partedUtil mklabel /dev/disks/<deviceID> gpt 

Create partition

In order to create the partition, we need to have a few info:

  1. The start sector: 2048
  2. The GUID for VMFS: AA31E02A400F11DB9590000C2911D1B8
  3. The end sector. This one should be calculated.

To calculate the end sector, we’ll issue the following command first:

# partedUtil getptbl /dev/disks/<deviceID> 

Use this formula to get the end Sector:

# eval expr $(partedUtil getptbl /dev/disks/<deviceID> | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1 

Now we have all the info and we can create the partition using the command:

# partedUtil setptbl /dev/disks/<deviceID> gpt "1 2048 <endSector> AA31E02A400F11DB9590000C2911D1B8 0" 

Format partition with VMFS6

# vmkfstools -C vmfs6 -S USB-Storage /dev/disks/<deviceID>:1 

Check Datastore in ESXi

Return to ESXi and check the Storage tab. You should see here the new Datastore.

Guide @ it-react.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment