I have just added a new host to my existing cluster of 8 x 5.1 hosts. I need to add the existing NFS datastores to this new host but we have over 40 datastores and Im wondering if theres a better way to add them all at once or is it best to use the web client and add the exports one at a time? Id prefer not to use PowerCLI right this moment to achieve this.
With PowerCLI you can actually automate adding NFS datastore to ESXI hosts.
To add a datastore to all hosts in a cluster,
get-vmhost | New-Datastore -NFS -Name <datastorename> -Path /<path to nfs mount point> -nfshost <hostname or IPaddress>
I understand that your scenario is to add multiple nfs datastores to the newly added host in the cluster.
This will assist you:
http://virtualbarker.com/2013/05/25/script-to-add-multiple-nfs-datastores-to-an-esxi-host/
Hope this helps!!
Thinking out loud, I could have used a Host Profile, but seeing as this host is a different model to the existing hosts, I didnt want to take a profile from one of them and use on the new host. If they were the same model then a host profile would save the manual entry of each DS.
On a vSphere 6.5 ESXi cluster, to add an existing NFS connection to a new host, preform the following steps:
From the Flash Web Client, start at Home, then select Storage, then select the specific NFS connection
Click the pull-down under the title "Connectivity with Hosts" (icon looks like 2 documents)
Check the host(s) that currently do not have the connection and click OK
PowerCLI would work great, especially if you use the Import-CSV command with files already populated with the ESXi hosts and NFS datastores.
nfs-datastores.txt - Datastores to map.
vmhosts.nfs - ESXi hosts to map datastores to.
Connect-VIServer -Server vcenter01
$dsin = Import-CSV nfs-datastores.txt
$hosts = Import-CSV vmhosts.nfs
foreach ($vmhost in $hosts){
write-host Doing $vmhost.vmHost
foreach ($ds in $dsin){
$x = Get-VMHost -Name $vmhost.vmHost | New-Datastore -NFS -Path $ds.NfsPath -NfsHost $ds.NfsHost -Name $ds.NfsName
write-host $x
}
}