Moving into NAS presented containers for datastores comes with some operational complexities, one of the most painful is in managing multiple hosts. When using the vSphere GUI, it is very slow and inefficient to mount multiple datastores across multiple hosts. If adding 6 datastores for 4 hosts, this would take 24 cycles of working through the new datastore wizard.
Enter Power-CLI - an extremely flexible and efficient set of command line utilities for managing ESX. Should be installed as part of the standard vSphere 5.1 management toolkit (haven't experiemented yet with 5.5)
Connecting to vCentre
connect-viserver
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Connect-VIServer
cmdlet Connect-VIServer at command pipeline position 1
Supply values for the following parameters:
Server[0]: vvc01
Server[1]:
Name Port User
---- ---- ----
vvc01 443 vcadmin
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-vmhost
Name ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz MemoryUsageGB MemoryTotalGB
---- --------------- ---------- ------ ----------- ----------- ------------- -------------
vmh01 Connected PoweredOn 20 11699 47880 94.672 127.974
vmh05 Connected PoweredOn 20 8849 47900 155.489 255.979
vmh03 Connected PoweredOn 20 20038 47900 206.244 255.974
vmh02 Connected PoweredOn 20 11307 47900 99.130 255.975
Mount Datastores
get-vmhost | new-datastore -Nfs -Name DATASTORE01 -path "/nfs01" -NfsHost 10.10.0.100
This will mount it on all VM Hosts. You can also selectively mount it on individual hosts (by simply running the "new-datastore" command and specifying a single host).
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-vmhost | new-datastore -Nfs -Name DATASTORE01 -path "/nfs07" -NfsHost 10.10.0.100
Name FreeSpaceGB CapacityGB
---- ----------- ----------
DATASTORE01 4,000.000 4,000.000
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-vmhost | new-datastore -Nfs -Name DATASTORE02 -path "/nfs02" -NfsHost 10.10.0.100
Name FreeSpaceGB CapacityGB
---- ----------- ----------
DATASTORE02 4,000.000 4,000.000
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-vmhost | new-datastore -Nfs -Name DATASTORE03 -path "/nfs03" -NfsHost 10.10.0.100
Name FreeSpaceGB CapacityGB
---- ----------- ----------
DATASTORE03 4,000.000 4,000.000
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-vmhost | new-datastore -Nfs -Name DATASTORE04 -path "/nfs04" -NfsHost 10.10.0.100
Name FreeSpaceGB CapacityGB
---- ----------- ----------
DATASTORE04 4,000.000 4,000.000
new-datastore : 5/11/2014 4:26:01 PM New-Datastore An error occurred during host configuration.
At line:1 char:14
+ get-vmhost | new-datastore -Nfs -Name DATASTORE04 -path "/nfs04" -NfsH ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-Datastore], ViError
+ FullyQualifiedErrorId : Client20_VmHostServiceImpl_NewNfsDatastore_ViError,VMware.VimAutomation.ViCore
.Cmdlets.Commands.Host.NewDatastore
Note : The NFS datastore limit was set to 8 on one specific ESX host. I increased it to 16 then re-ran this just for that host
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> new-datastore -VMHost vmh03 -Nfs -Name DATASTORE04 -path "/nfs04" -NfsHost 10.10.0.100
Name FreeSpaceGB CapacityGB
---- ----------- ----------
DATASTORE04 4,000.000 4,000.000