USB Drive as Datastore on ESXi 6.0

For my physical security I got a small PC with ESXi running on it. Now I needed more HDD space and I wanted to solve this with adding a USB drive to the PC for ESXi. Unfortunally I didn’t see it in the beginning as a datastore. But it’s possible !

Get the USB Drive connected as Datastore. What are the steps ?

First I enabled SSH on my ESXi host. Then I used putty to SSH to the machine.

When I did :

[root@localhost:~] ls /dev/disks
mpx.vmhba32:C0:T0:L0
mpx.vmhba32:C0:T0:L0:1
mpx.vmhba32:C0:T0:L0:5
mpx.vmhba32:C0:T0:L0:6
mpx.vmhba32:C0:T0:L0:7
mpx.vmhba32:C0:T0:L0:8
mpx.vmhba32:C0:T0:L0:9
t10.ATA_____SAMSUNG_MZ7GE240HMGR2D00005______________S1Y3NYAFB00841______
t10.ATA_____SAMSUNG_MZ7GE240HMGR2D00005______________S1Y3NYAFB00841______:1
t10.ATA_____ST2000LM003_HN2DM201RAD__________________S362J9EH178447______
t10.ATA_____ST2000LM003_HN2DM201RAD__________________S362J9EH178447______:1
vml.0000000000766d68626133323a303a30
vml.0000000000766d68626133323a303a30:1
vml.0000000000766d68626133323a303a30:5
vml.0000000000766d68626133323a303a30:6
vml.0000000000766d68626133323a303a30:7
vml.0000000000766d68626133323a303a30:8
vml.0000000000766d68626133323a303a30:9
vml.0100000000533159334e59414642303038343120202020202053414d53554e
vml.0100000000533159334e59414642303038343120202020202053414d53554e:1
vml.0100000000533336324a394548313738343437202020202020535432303030
vml.0100000000533336324a394548313738343437202020202020535432303030:1

I didn’t see my drive.

First you will have to stop the USBArbitrator for the USB Pass Through.

[root@localhost:~] /etc/init.d/usbarbitrator stop 
watchdog-usbarbitrator: Terminating watchdog process with PID 33583 usbarbitrator stopped
[root@localhost:~] chkconfig usbarbitrator off

Now connect the USB Drive to the PC.

And you will see the mpx.vmhba38 as a new drive.

[root@localhost:~] ls /dev/disks
mpx.vmhba32:C0:T0:L0
mpx.vmhba32:C0:T0:L0:1
mpx.vmhba32:C0:T0:L0:5
mpx.vmhba32:C0:T0:L0:6
mpx.vmhba32:C0:T0:L0:7
mpx.vmhba32:C0:T0:L0:8
mpx.vmhba32:C0:T0:L0:9
mpx.vmhba38:C0:T0:L0
mpx.vmhba38:C0:T0:L0:1
mpx.vmhba38:C0:T0:L0:2
t10.ATA_____SAMSUNG_MZ7GE240HMGR2D00005______________S1Y3NYAFB00841______
t10.ATA_____SAMSUNG_MZ7GE240HMGR2D00005______________S1Y3NYAFB00841______:1
t10.ATA_____ST2000LM003_HN2DM201RAD__________________S362J9EH178447______
t10.ATA_____ST2000LM003_HN2DM201RAD__________________S362J9EH178447______:1
vml.0000000000766d68626133323a303a30
vml.0000000000766d68626133323a303a30:1
vml.0000000000766d68626133323a303a30:5
vml.0000000000766d68626133323a303a30:6
vml.0000000000766d68626133323a303a30:7
vml.0000000000766d68626133323a303a30:8
vml.0000000000766d68626133323a303a30:9
vml.0000000000766d68626133383a303a30
vml.0000000000766d68626133383a303a30:1
vml.0000000000766d68626133383a303a30:2
vml.0100000000533159334e59414642303038343120202020202053414d53554e
vml.0100000000533159334e59414642303038343120202020202053414d53554e:1
vml.0100000000533336324a394548313738343437202020202020535432303030
vml.0100000000533336324a394548313738343437202020202020535432303030:1
[root@localhost:~]

[root@localhost:~] esxcli storage core device list | grep -i usb
 Is USB: false
 Is Boot USB Device: false
 Display Name: Local USB Direct-Access (mpx.vmhba32:C0:T0:L0)
 Is USB: true
 Is Boot USB Device: true
 Display Name: Local USB Direct-Access (mpx.vmhba38:C0:T0:L0)
 Is USB: true
 Is Boot USB Device: false
 Is USB: false
 Is Boot USB Device: false
[root@localhost:~] esxcli storage filesystem list
Mount Point Volume Name UUID Mounted Type Size Free
------------------------------------------------- ----------- ---------------- ------------------- ------- ------ ------------- ------------
/vmfs/volumes/57ed2398-c2dd3904-dc8a-6805ca013cae 240GbSSD 57ed2398-c2dd390 4-dc8a-6805ca013cae true VMFS-5 239981297664 238856175616
/vmfs/volumes/57ed364f-55323068-40dc-6805ca013cae HDD1.8Tb 57ed364f-5532306 8-40dc-6805ca013cae true VMFS-5 2000112582656 471507927040
/vmfs/volumes/57ed2150-8e14748c-236c-6805ca013cae 57ed2150-8e14748 c-236c-6805ca013cae true vfat 299712512 86212608
/vmfs/volumes/ab4898e7-13197047-026f-123b89294cab ab4898e7-1319704 7-026f-123b89294cab true vfat 261853184 261844992
/vmfs/volumes/11ec28e8-88ccd087-6cc8-2aa95065b143 11ec28e8-88ccd08 7-6cc8-2aa95065b143 true vfat 261853184 84054016

The drive has to be initialized.

[root@localhost:~] partedUtil mklabel /dev/disks/mpx.vmhba38\:C0\:T0\:L0 gpt

[root@localhost:~] partedUtil getptbl /dev/disks/mpx.vmhba38\:C0\:T0\:L0
gpt
121601 255 63 1953525167

You will need this formula to calculate the end sector :
In my case (121601 * 255 * 63) – 1 = 1953520064

[root@localhost:~] partedUtil setptbl /dev/disks/mpx.vmhba38\:C0\:T0\:L0 gpt "1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 1953520064 AA31E02A400F11DB9590000C2911D1B8 0

Create vmfs on the drive :

[root@localhost:~] vmkfstools -C vmfs5 -S USBDrive /dev/disks/mpx.vmhba38\:C0\:T0\:L0:1
create fs deviceName:'/dev/disks/mpx.vmhba38:C0:T0:L0:1', fsShortName:'vmfs5', fsName:'USBDrive'
deviceFullPath:/dev/disks/mpx.vmhba38:C0:T0:L0:1 deviceFile:mpx.vmhba38:C0:T0:L0:1
ATS on device /dev/disks/mpx.vmhba38: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.vmhba38:C0:T0:L0:1" with blockSize 1048576 and volume label "USBDrive".
Successfully created new volume: 59300ef2-206edf66-91fb-6805ca013cae
[root@localhost:~]

And finally I can see the USB Drive as a Datastore :

USB Drive for ESXi

5 Comments

  1. Marcel
  2. Jeff
  3. priyesh doriwala

Leave a Reply