| Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
The Change Network File System Export (EXPORTFS) command adds directory names to (exports) or removes directory names from (unexports) the list of directory trees that are currently exported to Network File System (NFS) clients. The flags in the OPTIONS list indicate what actions the EXPORTFS command should perform.
A list of directories and options for exporting the directory and its contents is stored in the /etc/exports file. The EXPORTFS command allows the user to export all of the directory trees specified in the /etc/exports file using the -A flag, or to export a single directory tree by specifying the directory name. When the directory tree to be exported exists in the /etc/exports file, the user can export it with the options specified there, or one can use the -I flag to override the options, specifying the new options on the EXPORTFS command.
Ths user can also export a directory tree not previously defined in the /etc/exports file by providing the options for it on the EXPORTFS command. The user can unexport directory trees by using the -U flag on the EXPORTFS command.
The forced unexport will be available only if the user specifies the -U flag and wants to release all NFS version 4 locks and state held by the NFS server on the exported file system. This option should only be used if the state cannot be removed through normal methods.
The user can also add, change, or remove export entries in the /etc/exports file by using the -F flag.
This command can also be issued using the following alternative command name:
For more information about Network File System commands, see the i5/OS Network File System Support book, SC41-5714.
Restrictions:
| Top |
| Keyword | Description | Choices | Notes |
|---|---|---|---|
| OPTIONS | NFS export options | Character value, *DFT | Optional, Positional 1 |
| DIR | Directory | Path name | Optional, Positional 2 |
| HOSTOPT | Host options | Single values: *DFT Other values (up to 10 repetitions): Element list |
Optional |
| Element 1: Host name | Character value | ||
| Element 2: Data file CCSID | 0-65535, *BINARY, *ASCII, *JOBCCSID | ||
| Element 3: Path name CCSID | 0-65535, *ASCII, *JOBCCSID | ||
| Element 4: Force synchronous write | *SYNC, *ASYNC |
| Top |
The export options list contains some flags followed optionally by a list containing a character string of characteristics for the directory tree to be exported.
Each flag consists of a minus "-" followed by a character. The flags are separated by spaces. Only certain combinations of flags are allowed. If an invalid combination is detected, an error is returned.
Note: A value (other than *NONE) must be specified for either the OPTIONS or Directory (DIR) parameter. Both OPTIONS and DIR can be specified so long as '-A' is not part of the options list specified for the OPTIONS parameter.
'-A'
Note: Successful use of the -F flag will cause the contents of the /etc/exports file to be replaced completely such that it reflects the changes, additions, or deletions caused by the -F flag. Any unrelated existing entries are copied, however ALL comments in the /etc/exports file will be lost as a result of using the -F flag.
If options are required and the -O flag is not specified, the following are the default options.
The following are the available options and their descriptions.
If neither RO or RW is specified, then 'RW=' is assumed, and all host names have read-write access to the exported directory.
If the user does not want to allow any requests from unknown users, use 'ANON=-1'.
| Top |
Specifies the absolute path name of the existing directory to be exported (made available to NFS clients) or unexported (made unavailable to NFS clients). This directory can not be a subdirectory or a parent of an already exported directory (unless it is in a different file system). This parameter is not allowed when the -A flag is specified on the NFS export options (OPTIONS) parameter. This parameter is required when the -F flag is specified on the OPTIONS parameter.
Note: A value (other than *NONE) must be specified for either the OPTIONS or DIR parameter. Both OPTIONS and DIR can be specified so long as '-A' is not part of the options list specified for the OPTIONS parameter.
| Top |
The HOSTOPT parameter has four elements that specify additional information about the NFS clients that a directory tree is to be exported to. If the HOSTOPT parameter is not specified for a host name the user is exporting the directory tree to, the defaults for each of the elements of the HOSTOPT parameter are assumed for that host.
Element 1: Host name
The name of the host for which additional options are to be specified. This host should be specified above in the OPTIONS -O list as a host that has access to the exported directory tree. Specify either a single host name that is an alias for an address of a single host or a netgroup name to be associated with these options.
The user can assign names to an internet address with the Work with TCP/IP host table entries option on the Configure TCP/IP menu (CFGTCP) command or via the System i Navigator. Also, a remote name server can be used to map remote system names to internet addresses.
Element 2: Network data file coded character set identifier (CCSID)
The network data file CCSID is used for data of the files sent and received from the specified HOST NAME (or netgroup name). For any hosts not specified on a HOSTOPT parameter, the default network data file CCSID (*BINARY) is used. The CCSID may be one of the following:
Element 3: Network path name coded character set identifier (CCSID)
The network path name CCSID is used for the path name components of the files sent to and received from the specified HOST NAME (or netgroup name). For any hosts not specified on a HOSTOPT parameter, the default network path name CCSID (*ASCII) is used. The CCSID may be one of the following:
Element 4: Write mode
Specifies whether write requests are handled synchronously or asynchronously for this HOST NAME (or netgroup name). The default value of *SYNC means that data will be written to disk immediately. *ASYNC does not guarantee that data is written to disk immediately, and can be used to improve server performance.
Note: The Network File System (NFS) protocol has traditionally used synchronous writes.
| Top |
The alternative command name for EXPORTFS is CHGNFSEXP. The following examples use the alternative command name, but EXPORTFS can be replaced directly for CHGNFSEXP in all of them.
Example 1: Exporting All Entries from /etc/exports
CHGNFSEXP OPTIONS('-A')
-or-
CHGNFSEXP '-A'
Both of these commands export all entries that exist in the /etc/exports file.
Example 2: Exporting One Directory with Options
CHGNFSEXP '-I -O RO,ANON=guest1,ACCESS=Roch1:9.7.431.2'
'/programs/public' HOSTOPT((MIAMI1 850 850))
This command exports the directory tree under the path name /programs/public as read-only. It allows only two clients to mount this directory tree. It takes advantage of the positional parameters OPTIONS and DIR. It uses the HOSTOPT parameter to specify coded character set identifier (CCSID) for the host MIAMI1.
Example 3: Exporting One Directory with Options and Updating the /etc/exports File.
CHGNFSEXP '-I -F -O RO,ANON=guest1,ACCESS=Roch1:9.7.431.2'
'/programs/public' HOSTOPT((MIAMI1 850 850))
This command exports the directory tree under the path name /programs/public as read-only. It allows only two clients to mount this directory tree. The OPTIONS parameter value is specified positionally. It uses the HOSTOPT parameter to specify data and path name coded character set identifiers (CCSIDs) of 850 for host name MIAMI1.
In addition, it also adds an export entry for /programs/public, along with the OPTIONS and HOSTOPT parameter values, to the /etc/exports file.
Example 4: Exporting One Directory with NFS version 4 Options
CHGNFSEXP '-I -O RO,VERS=4,SEC=KRB5,ACCESS=9.7.431.2'
'/programs/public'
This command exports the directory tree under the path name /programs/public as read-only. It allows only one client to mount this directory tree. It allows access only through NFS version 4 protocol and requires a minimum of Kerberos version 5 authentication.
| Top |
*ESCAPE Messages
| Top |