IBM Support

Linux® and AIX® NFS Server v4 Configuration Tips

Question & Answer


Question

Support for NFS v4 was introduced for the z/OS® NFS Client in z/OS V1R9. In order for a successful v4 mount to occur to a remote Linux® or AIX® NFS Server that also supports NFS v4, some additional configuration might be necessary on the remote NFS Server. This document describes some common configuration tips for both platforms to enable a successful NFS v4 mount.

Answer

Linux® Configuration Tips:
In /etc/exports, NFSv4 sharing must be enabled for each exported file system. The fsid=0 parameter indicates that NFSv4 sharing is enabled.

In the following example of an /etc/exports file, only the /media/hda/test file system is exported for NFSv4 mounts:

/media/hda/user/code myhost.test.domain.com(rw,no_root_squash,insecure)
/media/hda/user/index myhost.test.domain.com(rw,no_root_squash,insecure)
/media/hda/test nfsclient.test.domain.com(fsid=0,rw,no_root_squash,insecure)


Note: The "exportfs -rav" Linux® shell command must be run to allow the changes made to /etc/exports  to take effect.

Even with the fsid=0 parameter added, the same mount command used with NFS v3 does not work with the NFS v4 protocol. An entry specified in /etc/exports for NFS v4 is the basis of an NFS v4 virtual file system; the file system specified becomes a pseudo root file system in NFS v4.  In order to successfully mount the Linux® file system with NFS v4, reference the file system as "servername:/" in the mount command.

Example TSO MOUNT command mounting from nfsclient.test.domain.com to a remote Linux® NFS Server, nfsserver.test.domain.com, for file system /media/hda/test, as specified in the sample /etc/exports file listed previously:

MOUNT FILESYSTEM('NFSMOUNT') +
TYPE(NFS) +
MODE(RDWR) +
UNMOUNT +
MOUNTPOINT('/u/nfs/media') +
PARM('nfsserver.test.domain.com:"/",vers(4),XLAT(Y)')


An NFS v4 mount issued from the z/OS® NFS Client fails with the following error when:
  1. the fsid=0 parameter is not specified in /etc/exports on the Linux® NFS v4 Server or
  2. multiple exports entries use the fsid=0 parameter to export to the same host (refer to information following the error message).
BPXF028I FILE SYSTEM NFSMOUNT WAS NOT MOUNTED. RETURN CODE = 00000081, REASON CODE = 6E050002

Exporting multiple file systems with the fsid=0 parameter to the same host cannot be successful, since there can be only one psuedo root file system in NFS v4.   These same mounts are successful if mounted with NFS v3, though the directory contents as viewed from the NFS Client are unpredictable.  In order to emulate NFS v3-like behavior with multiple exported file systems to the same host, the following procedure can be used:

Create an export directory, such as /export. Then, create directories underneath the /export directory to represent each file system exported in /etc/exports:

mkdir /export
mkdir /export/code
mkdir /export/index


Next, "link" the true directories to your /export representations of the directories:

mount --bind /real/path/to/code /export/code
mount --bind /real/path/to/index /export/index


Modify /etc/exports to export all three directories. Specify the fsid=0 parameter only in the entry for /export, which makes /export the NFS v4 psuedo root file system. Note the use of the nohide parameter, as well, which is required to allow the directory contents to be visible to the NFS Client.

/export myhost.test.domain.com
(fsid=0,rw,nohide,no_root_squash,no_subtree_check,insecure)
/export/code myhost.test.domain.com
(rw,nohide,no_root_squash,no_subtree_check,insecure)
/export/index myhost.test.domain.com
(rw,nohide,no_root_squash,no_subtree_check,insecure)


Example TSO MOUNT command mounting from myhost.test.domain.com to a remote Linux® NFS Server, nfsserver.test.domain.com, for real file system /real/path/to/code with NFS v4 and the new /etc/exports sample that exports multiple file systems:

MOUNT FILESYSTEM('NFSMOUNT') +
TYPE(NFS) +
MODE(RDWR) +
UNMOUNT +
MOUNTPOINT('/u/nfs/code') +
PARM('nfsserver.test.domain.com:"/code",vers(4),XLAT(Y)')


Example TSO MOUNT command for the same mount and configuration with NFS v3:

MOUNT FILESYSTEM('NFSMOUNT') +
TYPE(NFS) +
MODE(RDWR) +
UNMOUNT +
MOUNTPOINT('/u/nfs/code') +
PARM('nfsserver.test.domain.com:"/export/code",vers(3),XLAT(Y)')

AIX Configuration Tips:

Similar to Linux®, AIX must also be configured for NFS v4 by enabling each file system for access in /etc/exports. The vers= parameter specifies what access protocols can be used for the file system.

In the following example of an entry from /etc/exports, the /nfs file system is exported for access by both the NFS v3 and NFS v4 protocols:

/nfs -sec=sys,vers=3:4,rw,access=nfsclient.test.domain.com
Issue the following AIX shell commands when changes are made to /etc/exports to first unexport the existing file systems and then reexport the new /etc/exports definitions:
  1. exportfs -ua
  2. exportfs -a
The unexport command can be run only if there is no NFS work or NFS operations in progress. If there is work in progress, the "exportfs -a" AIX shell command can be run alone, though mount failures can occur until the internal cache clears and is reset with the new export definition.

No changes are required to the mount commands, as are required with Linux® and NFS v4.

When the vers=4 parameter is not specified in the /etc/exports on the AIX NFS Server that supports NFS v4, an NFS v4 mount issued from the z/OS NFS Client fails with the following error:

BPXF028I FILE SYSTEM NFSMOUNT WAS NOT MOUNTED. RETURN CODE = 00000081, REASON CODE = 6E050002

Another problem can occur with NFS v4 mounts to an AIX NFS Server when the NFS domain is not set or the NFS registry daemon is not running.

Set the NFS domain with the following AIX shell command: chnfsdom <domainname>

If the NFS Server and NFS Client are in the same DNS domain, set the NFS domain to the same value as the DNS domain. If the NFS Server and Client reside in different DNS domains, select any appropriate domain name to set as the NFS domain. For example, if the NFS Client is in dallas.ibm.com and the NFS Server is in austin.ibm.com, you might create an NFSdomain of nfs.ibm.com and then run 'chnfsdom nfs.ibm.com' on the NFS AIX Server. (There is no need to set the NFS domain on the z/OS NFS Client).

Start the registry daemon with the following AIX shell commands (the second command ensures that the registry daemon remains active):

startsrc -s nfsrgyd
lssrc -s nfsrgyd


If the NFS domain is not set or if the NFS registry daemon is not running, NFS v4 mounts issued from the z/OS NFS Client appear to never complete. A "D OMVS,F" display of the NFS v4 mount shows a status of "ASYNCH MOUNT IN PROGRESS". A z/OS NFS Client CTRACE shows a "looping condition" for the mount request, where the z/OS NFS Client sends a properly formatted NFS v4 compound to the AIX NFS Server. In reply to that RPC compound, the AIX NFS Server returns an error on the final operation in the compound, GETATTR, of NFS4ERR_RESOURCE, indicating: Resource exhaustion.  The z/OS NFS Client waits for 15 seconds and then again attempts to resend the same compound, in the hopes that the resource exhaustion situation clears. This same cycle continues endlessly.

Unmount a file system stuck in this condition and contact the administrator of the remote AIX NFS Server to set the NFS domain and start the NFS registry daemon.

The registered trademark Linux® is used pursuant to a sublicense from the Linux® Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG90","label":"z\/OS"},"Component":"5695DF121 - DFSMS\/MVS NETWORK FILE SYSTEM SERVER (NFS)","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB56","label":"Z HW"}}]

Document Information

Modified date:
03 September 2021

UID

isg3T1010447