VMware: How To Mount a USB Thumb Drive as a Data Store

Although USB is not a recommended data store type, it is still possible to mount this type of storage in VMWare. It should also be noted that VMWare will not provide support for this work around. Caveat emptor to those who choose to follow my mickey mouse methods. Also, one must be advised that a change in “USB Arbitrator” setting will affect all guests on such particular host.

Some benefits of using USB media are for storing: ISOs, infrequently used bulk files, and backup repositories. This is to save precious SAN volumes for other redundancy required production workloads.

# Get a list of existing disks

[rambo@testbox:~] ls /dev/disks/
mpx.vmhba33:C0:T0:L0
mpx.vmhba33:C0:T0:L0:1
mpx.vmhba33:C0:T0:L0:5
mpx.vmhba33:C0:T0:L0:6
mpx.vmhba33:C0:T0:L0:7
mpx.vmhba33:C0:T0:L0:8
mpx.vmhba33:C0:T0:L0:9
t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____
t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____:1
vml.0000000000766d68626133333a303a30
vml.0000000000766d68626133333a303a30:1
vml.0000000000766d68626133333a303a30:5
vml.0000000000766d68626133333a303a30:6
vml.0000000000766d68626133333a303a30:7
vml.0000000000766d68626133333a303a30:8
vml.0000000000766d68626133333a303a30:9
vml.0100000000533235304e5830483833353139324a202020202053616d73756e
vml.0100000000533235304e5830483833353139324a202020202053616d73756e:1

# Stop USB Arbitrator (pass-through) service
/etc/init.d/usbarbitrator stop

# Disable USB Arbitrator
chkconfig usbarbitrator off

# Plugin USB thumb drive

# Run list disks command again to locate the newly detected item
[rambo@testbox:~] ls /dev/disks/
mpx.vmhba32:C0:T0:L0
mpx.vmhba32:C0:T0:L0:1
mpx.vmhba33:C0:T0:L0
mpx.vmhba33:C0:T0:L0:1
mpx.vmhba33:C0:T0:L0:5
mpx.vmhba33:C0:T0:L0:6
mpx.vmhba33:C0:T0:L0:7
mpx.vmhba33:C0:T0:L0:8
mpx.vmhba33:C0:T0:L0:9
t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____
t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____:1
vml.0000000000766d68626133323a303a30
vml.0000000000766d68626133323a303a30:1
vml.0000000000766d68626133333a303a30
vml.0000000000766d68626133333a303a30:1
vml.0000000000766d68626133333a303a30:5
vml.0000000000766d68626133333a303a30:6
vml.0000000000766d68626133333a303a30:7
vml.0000000000766d68626133333a303a30:8
vml.0000000000766d68626133333a303a30:9
vml.0100000000533235304e5830483833353139324a202020202053616d73756e
vml.0100000000533235304e5830483833353139324a202020202053616d73756e:1

# Make partition table for new disk
partedUtil mklabel /dev/disks/vml.0000000000766d68626133323a303a30 gpt

# Find end sector
partedUtil getptbl /dev/disks/vml.0000000000766d68626133323a303a30

[rambo@testbox:~] partedUtil getptbl /dev/disks/vml.0000000000766d68626133323a303a30
Error: The primary GPT table on '/dev/disks/mpx.vmhba32:C0:T0:L0' is OK, but secondary is corrupt. Fix secondary table? This will move secondary at the end in case it is not at the end already. It will also set LastUsableLBA to use all the space at the end. diskSize (1048576000) AlternateLBA (1048575999) LastUsableLBA (1048575966)
gpt
65270 255 63 1048576000

# Calculate
# 65270 * 255 * 63 - 1 = 1048562549

# Create VMFS partition
# The start sector is always 2048
# The GUID for VMFS is AA31E02A400F11DB9590000C2911D1B8
partedUtil setptbl /dev/disks/vml.0000000000766d68626133323a303a30 gpt "1 2048 1048562549 AA31E02A400F11DB9590000C2911D1B8 0"

# An example of command being successful
[rambo@testbox:~] partedUtil setptbl /dev/disks/vml.01000000003443353330303030323430
343230313035353335556c74726120 gpt "1 2048 240252074 AA31E02A400F11DB9590000C291
1D1B8 0"
gpt
0 0 0 0
1 2048 240252074 AA31E02A400F11DB9590000C2911D1B8 0

# Run this command if the existing gpt disk has errors
[rambo@testbox:~] partedUtil fixGpt /dev/disks/vml.0000000000766d68626133323a303a30
FixGpt tries to fix any problems detected in GPT table.
Please ensure that you don't run this on any RDM (Raw Device Mapping) disk.
Are you sure you want to continue (Y/N): Y
Error: The primary GPT table on '/dev/disks/mpx.vmhba32:C0:T0:L0' is OK, but secondary is corrupt. Fix secondary table? This will move secondary at the end in case it is not at the end already. It will also set LastUsableLBA to use all the space at the end. diskSize (1048576000) AlternateLBA (1048575999) LastUsableLBA (1048575966)
Fix/Ignore/Cancel? Fix
gpt
65270 255 63 1048576000
1 2048 1048562549 AA31E02A400F11DB9590000C2911D1B8 vmfs 0

# Format partition with vmfs6
vmkfstools -C vmfs6 -S USB-Datastore1 /dev/disks/vml.0000000000766d68626133323a303a30:1

# Example of successful command
[rambo@testbox:~] vmkfstools -C vmfs6 -S USB-Datastore /dev/disks/vml.01000000003443
353330303030323430343230313035353335556c74726120:1
create fs deviceName:'/dev/disks/vml.01000000003443353330303030323430343230313035353335556c74726120:1', fsShortName:'vmfs6', fsName:'USB-Datastore'
deviceFullPath:/dev/disks/t10.SanDisk00Ultra00000000000000000000004C530000240420105535:1 deviceFile:t10.SanDisk00Ultra00000000000000000000004C530000240420105535:1
ATS on device /dev/disks/t10.SanDisk00Ultra00000000000000000000004C530000240420105535:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Creating vmfs6 file system on "t10.SanDisk00Ultra00000000000000000000004C530000240420105535:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "USB-Datastore".
Successfully created new volume: 5d5ab29d-2aa0b031-7cbf-94c691abb6e2

# Check mounts
esxcfg-scsidevs -m

[rambo@testbox:~] esxcfg-scsidevs -m
t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____:1 /vmfs/devices/disks/t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____:1 5c8206f0-49fe1606-76b6-94c691abb6e2 0 SamsungSSD
mpx.vmhba32:C0:T0:L0:1 /vmfs/devices/disks/mpx.vmhba32:C0:T0:L0:1 5d59f580-2570f44c-5b05-94c691abb6e2 0 USB-Datastore1

[root@esx1:~] esxcfg-scsidevs -m
t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____:1 /vmfs/devices/disks/t10.ATA_____Samsung_SSD_850_PRO_512GB_______________S250NX0H835192J_____:1 5c8206f0-49fe1606-76b6-94c691abb6e2 0 SamsungSSD
t10.SanDisk00Ultra00000000000000000000004C530000240420105535:1 /vmfs/devices/disks/t10.SanDisk00Ultra00000000000000000000004C530000240420105535:1 5d5ab29d-2aa0b031-7cbf-94c691abb6e2 0 USB-Datastore

Leave a Reply

Your email address will not be published. Required fields are marked *