Since the source to the article that truely answers this question has been relegated to wayback machine on internet archive at this point,
I found a way to do this from inside of vmware using partedUtil to partition and vmkfstools to format the partition to make it a datastore without using any other tools at all.
[Begin Disclaimer]
FYI: for all the datajockey’s out there saying DON’T do this… In my case I’m using an NVMe M.2 drive in a NVMe to USB-C cage for a “real” hard drive but plugging it into the USB header inside a server… that back in the day (pre vmware 6.7) was fully acceptable and supported way of booting ESXi.
I understand the normal concern with performance and danger when doing this with a normal USB stick, but in my case vmware recognizing this as USB storage it was refusing to create the datastore, which if this was just in an M.2 port on the server mainboard it would not have even been an issue.
My usage case was to separate the ESXi boot drive from the RAID in the server so the whole RAID in the server is available an segregated from the ESXi boot disk — but I still wanted to have a Datastore on the NVMe/USB to put ISOs I would use to install os that would be on the RAID Storage.
[disclaimer end]
ADDING NEW PARTITION:
partedUtil allows creation of table, deletion of partition, resizing of partition, but no “add partiton” other than printing the existing partition table, and then resetting it using the existing info, and appending the new info.
Since the ESXi boot disk numbers partitions 1, 5-9 any partition you make with a third party tool is going to try to be partition 2.
vmware documentation for parted util can be found at:
https://knowledge.broadcom.com/external/article/323144/using-partedutil-command-line-disk-parti.html
Turn on ESXi Shell and SSH either from the Console of the server, or start the services from the ESXi web ui.
connect to ESXi using putty
Issue following commands, and use the info they provide to help you craft the solution to match your drive:
ls -ltrh /vmfs/devices disks
get existing partition table using name from above command, using the tab key to complete the name of the device, so we dont have to type the whole thing:
partedUtil getptbl /vmfs/devices/disks/vml.01[tab]
craft the command to “replace” the existing partition table by over writing it with a new table that contains all of the existing table, and appending the new partiton we are wanting to create:
The command above shows the a disk info line for example in my case “31130 255 63 500118192”
Use this last number minus 2096 as the max number of sectors to determine the end of the new partition, and the end of partition 9…
“9 1843200 7086079”
add 1 to start it right after that partition, and specify the type of partition it will be using table found by running command:
partedUtil showGuids
so for example:
if end of partition 9 is 7086079
and end of the disk is 500118192 (minus 2096 = 500118192)
and we want to create a vmfs partition type “AA31E02A400F11DB9590000C2911D1B8”
we come up with:
“10 7086080 500118192 AA31E02A400F11DB9590000C2911D1B8 0”
partedUtil allows creation of table, deletion of partition, resizing of partition, but no “add partiton” other than printing the existing partition table, and then resetting it using the existing info, and appending the new info.
so in my example, I used the results from “partedUtil getptbl” above, and pasted them into a “partedUtil setptbl” command, putting quotes around each line, removing the text to put it in the right format, and then just added my new partition at the end of the command:
example result:
partedUtil setptbl /vmfs/devices/disks/vml.010000000030313233343536373839323353534b205374 gpt "1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B 128" "5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 0" "6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 0" "7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 0" "8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 0" "9 1843200 7086079 9D27538040AD11DBBF97000C2911D1B8 0" "10 7086080 500116096 AA31E02A400F11DB9590000C2911D1B8 0"
next verify the table changed to match your input, again using the tab key to complete the name of the device, so we dont have to type the whole thing:
partedUtil getptbl /vmfs/devices/disks/vml.01[tab]
FORMATTING THE PARTITION AS VMFS:
vmkfstools -C vmfs6 -S USB-Stick /dev/disks/mpx.vmhba32:C0:T0:L0:10
In vCentre or ESXi web interface refresh and then check to see if the new Datastore is showing.
In my case it just showed up I didn’t have to do anything else.