How to mount a NFS share using CLI

Just a quick post how to mount a NFS share using the ESXi CLI.

You all probably know that when it comes to storage protocols, NFS is often used with NAS storage devices. You can mount a NFS share with the vSphere client. But when mouting a NFS share through the vSphere client fails, it’s handy to try it through the CLI. When mounting a NFS share through the CLI you get more info when the mount fails or successes.

So how can you mount a NFS share using the CLI?

Show all active mounts: esxcfg-nas -l

Delete a NFS share: esxcfg-nas -d [datastorename]

Add a NFS share: esxcfg-nas -a –host [nfsserver dns/ip] –share [share name] [datastorename] –readonly

The option –readonly is optional.

Before you mount a NFS share, make sure you know the full path of the share. It’s possible that you have provided a NFS share name like “VMDatastore1” but that the full export name is /nfs/VMDatastore1. This can be vendor specific.
Share names are case sensitive.