Duplicate NFS datastore names appear when adding to multiple hosts

I observed some strange behaviour in the lab recently whereby I was attempting to add an NFS datastore to all hosts (to be used as a shared vmware tools repository). I was expecting to see vmtools as the datastore name listed for all hosts, but instead saw vmtools, vmtools (1), and vmtools (2). This odd behaviour seemed to be inconsistent in that it wouldn’t always do 1:1 mapping of a single host to a datastore name and would often change the number of hosts attached to each datastore name. This appears to be some sort of race condition.

vmtools (1) Datastore

vmtools (2) Datastore

vmtools Datastore

I spent the best part of an hour trying to work out exactly why this was happening, and could not come to a conclusion. Thus, I did what any person with a little bit of OCD would do, I persisted to get some consistency.

The solution

Use PowerCLI.

New-Datastore

Get-VMHost | New-Datastore -Nfs -Name vmtools -Path /mnt/ssd120/vmware/vmtools/ -NfsHost 192.168.200.250

Tweak your PowerCLI to suit your needs. Whilst this is common knowledge for most people, it should be noted that it was the only method I could find that ensure consistent naming across all hosts.

 

For reference, this was observed against vCenter Server Appliance 6.5.0d and ESXi 6.5.0d.

Leave a Reply

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