Wednesday, June 24, 2009

Creating NFS datastores on a VMware cluster

The one issue I have seen so far with VMware storage is with regards to NFS datastores; they have to be configured onto each node in the cluster individually. Since this is done manually, it can be prone to error, so I started using the following powershell commands to perform it on all the hosts in a cluster.

foreach ($ESXhost in get-cluster clustername| get-vmhost)
{
New-datastore –nfs –vmhost $ESXhost –name datastorename –path /export/share –nfshost servername
}


Simply replace the clustername, datastorename, /export/share and servername with the appropriate values and run it in the VI Toolkit Powershell extension

1 comment:

edgoad said...

FYI - removal of datastores can be performed in a similar fashion:


foreach ($ESXhost in get-cluster clustername| get-vmhost)
{
remove-datastore –vmhost $ESXhost –Datastore datastorename -Confirm:$false
}