You can use the esxcli command or the vSphere Client to configure the NFS datastore depending on the NFS version and the configuration you want to set.

Understand the esxcli Command Parameters for NFS Datastores

Use the esxcli command to configure specific settings on NFS.

Command Description

NFS 4.1: esxcli storage nfs41 add

NFS 3: esxcli storage nfs add

Adds a new NFS or NAS volume and mounts it with the given volume name on the ESXi host .

NFS 4.1: esxcli storage nfs41 param set

NFS 3: esxcli storage nfs param set

Sets the NFS volume parameters.
The commands accept the following options:
Option Description
-H|--hosts=<str>

NFS 4.1: The hostname or IP address of the server for the NFS 4.1 volume you want to add. You can add multiple NFS volumes separated with a comma.

NFS 3: The hostname or IP address of the NAS volume you want to add and mount on the system.

-I|--host-vmknic=<str>

NFS 4.1: The hostname or IP address of the server for the NFS 4.1 volume you want to add followed by a colon(:) and the VMknic name. You can specify multiple names. Example: --host-vmknic=<host1>:<vmknic1> --host-vmknic=<ip2>:<vmknic2>

NFS 3: The hostname or IP address of the NAS volume you want to add. You can specify only one name. Example: <ip1>:<vmknic1>

-p|--ispe If set, this flag will set PE as the mount point.
-r|--readonly If set, this flag will make the mount point be read-only.
-a|--sec=<str> Security setting. Acceptable values are: AUTH_SYS, SEC_KRB5, and SEC_KRB5I. This option is applicable only for NFS 4.1 and later.
-s|--share=<str> The share name to use for the NFS or NAS mount point on the remote system. This option is required.
-v|--volume-name=<str> The volume name to use for the NFS or NAS mount. The volume name must be unique and should not conflict with existing NAS, NFS, VMFS, or other volume names. This option is required.
-c|--connections=<long> The number of RPC connections to be established for the NFS datastore. A higher number of connections results in better performance on datastores with higher I/O load.
-q|--maxqueuedepth=<long> The maximum queue depth for the NFS volume. This option can be used only with the param set command.

Configure Multiple TCP Connections for NFS

You can configure NFS storage with multiple connections by using the nconnect option. For NFS 4.1, you can create multiple connections per session. For NFS 3, you can mount the datastore with multiple connections. Use the esxcli storage nfs41 command to configure multiple connections.

You can set a maximum of 4 connections per NFS datastore by default. However, you can increase it up to 8 by using the advanced NFS option. Ensure that the total number of connections across all mounted NFS datastores does not exceed 256.

For NFS 4.1, setting up multiple connections does not impact multipathing. Multiple connections and multiple paths can co-exist.

Note: The commands in the folllowing procedure are examples for NFS 4.1 datastores. For NFS 3 datastores, replace nfs41 with nfs.

Prerequisites

Set up the NFS storage environment.

Procedure

  1. To specify the number of connections while mounting the NFS datastore, use the following command:
    esxcli storage nfs41 add -H <host> -v <volume-label> -s <remote_share> -c <number_of_connections>
  2. To specify the number of connections on an existing NFS datastore, use the following command:
    esxcli storage nfs41 param set -v <volume-label> -c <number_of_connections>
  3. (Optional) To increase the number of connections up to 8, use the following command:
    esxcli storage nfs41 param set -v <volume-label> -c <number_of_connections>

Configure VMkernel Binding for NFS Datastore

VMkernel port binding for the NFS datastore on an ESXi host allows you to bind an NFS volume to a specific VMkernel adapter to connect to an NFS server. With NFS datastores, you can isolate NFS traffic to a specific VMkernel adapter. To route the traffic to this adapter, connect the datastore to the adapter.

Note: Without binding, if the VMkernel adapter that ESXi uses for NFS traffic fails, the network infrastructure redirects the traffic to an alternative route. As a result, the NFS traffic might unintentionally flow through a random VMkernel adapter.

Configure VMkernel Binding for NFS 4.1 Datastores

To connect an NFS 4.1 datastore to a specific VMkernel adapter, use the esxcli storage nfs41 command. You can specify the VMkernel adapters either while mounting the NFS 4.1 datastore or, if the NFS datastore is already mounted with a specific VMkernel adapter, you can modify the existing NFS volume configuration to specify the desired VMkernel adapters.

Prerequisites

  • Set up the NFS storage environment.
  • Create and configure a VMkernel adapter on default TCP/IP stack.

Procedure

  1. To specify VMkernel adapters while mounting a new NFS v4.1 volume on the ESXi host, use the following command:
    [root@:~] esxcli storage nfs41 add

    Example: [root@:~]esxcli storage nfs41 add -I 10.187.114.32:vmk0 -I 10.187.214.27:vmk1 -s /store1 -v store1

  2. To set the VMkernel adapters on an existing NFS 4.1 datastore, use the following command:
    [root@:~] esxcli storage nfs41 param set

    Example: [root@:~] esxcli storage nfs41 param set -I 10.187.114.32:vmk2 -v store1

  3. (Optional) Verify whether the specified VMkernel adapters are set:
    [root@:~] esxcli storage nfs41 list

    The output should be similar to the following:

    Volume Name  Host(s)                      Share    Vmknics     Accessible  Mounted  Connections  Read-Only  Security   isPE  Hardware Acceleration
    -----------  -------------                -------  -------     ----------  -------  -----------  ---------  --------  -----  ---------------------
    store1       10.187.114.32,10.187.214.27   /store1   vmk2,vmk1        true     true            1                         false              AUTH_SYS  false     Not Supported

Configure VMkernel Binding for NFS 3 Datastores

For NFS 3 datastores, you can use the vSphere Client to connect the datastore to the desired VMkernel adapters.

Prerequisites

  • Set up the NFS storage environment.
  • Create and configure a VMkernel adapter on default TCP/IP stack.

Procedure

  1. Bind an NFS 3 datastore to a VMkernel adapter.
    1. In the vSphere Client navigator, browse to a host, a cluster, or a data center.
    2. From the right-click menu, select Storage > New Datastore.
    3. Select NFS as the datastore type, and select NFS 3.
    4. Enter the datastore parameters. For more information, see Create an NFS Datastore in vSphere Environment.
    5. Select Bind to vmknic.
    6. If you are creating the datastore at the data center or cluster level, select hosts that mount the datastore.
    7. For the datastore at the data center or cluster level, select one of the following options.
      • Select Vmknics on all hosts. With this option, selectable VMkernel adapters are available across all hosts where you mount your datastore.
      • Select Vmknic per host. With this option, you can specify a VMkernel adapter per host.
        Note: You can perform only one selection at a time.
    8. Review the configuration options you made and click Finish.
  2. Review the hosts connected to the NFS 3 datastore.
    1. In the vSphere Client, select the NFS 3 datastore with VMkernel adapter binding.
    2. Click the Configure tab, and click Connectivity with Hosts.
    You can view all the hosts connected to the NFS 3 datastore. The Vmknic Binding column shows the VMkernel adapters connected to the datastore The illustration shows all the VMkernel adapters connected to the NFS 3 datastore with VMkernel binding.
    Note: If you delete the VMkernel adapter associated with the NFS 3 datastore, the datastore becomes inaccessible triggering a warning. The warning displays the text in the Events screen similar to the following.

    vmknic vmkX removed, NFSv3 datastore datastore_name configured with the vmknic will be inaccessible.