logo

Manual Pages


Table of Contents

NAME

na_exportfs - export and unexport files or directories

SYNOPSIS

exportfs [ -afipuv ] [ -o options ] [ pathname ]

exportfs [ -c ] host pathname [ ro | rw | root ]

exportfs -s pathname

exportfs -d

exportfs -r

exportfs -w pathname

exportfs -h

DESCRIPTION

The exportfs command can be used to export directories and files, determine the current exports, check the access cache for an export, determine the actual storage path of an export, and revert the export file to a rule version prior to ONTAP 6.5.

If no pathname is specified, exportfs lists all currently exported directories and files. If pathname is specified, exportfs makes the specified file or directory available or unavailable for mounting by NFS clients.

In UNIX, it is illegal to export a directory that has an exported ancestor in the same file system. Data ONTAP does not have this restriction. For example, you can export both the /vol/vol0 directory and the /vol/vol0/home directory. In determining permissions, the filer uses the longest matching prefix.

OPTIONS

-a
Takes the list of path names to be exported from the /etc/exports file. If you specify pathname in the command when using the -a option, the command ignores pathname. Using this option will not unexport any file systems that have already been exported by either using the command line or through /etc/exports and are no longer in the /etc/exports file. A user needs to use the -u option to do that.

-c
This option allows both pre-caching of entries in the access cache and checking of rules in the access cache. The additional parameters are:

host a dotted IP address of the client to check in the access cache.

pathname
the path of the export node to check in the access cache.

[ ro | rw | root ]
whether to check for read-only (ro), read-write (rw), or root ((root) permissions. Note that if this final parameter is not provided, the exportfs -c command will check to see if the client has mount permissions to the export.

-f
Allows for the access cache to be flushed. With no path parameter, exportfs -f will remove all entries in the access cache. With a supplied path name, it will remove only the cached entries for the export node with the associated path name.

-h
Provide a more verbose command line usage.

-i
Ignores the options in the /etc/exports file. Without the -i option, the exportfs command uses the options associated with the pathname specified in /etc/exports and ignores any options specified on the command line.

-d
Reverts the exports file to the rule format used prior to ONTAP 6.5.

-p option
Commits the normally non-persistant export rules being passed in to /etc/exports. This option allows for the persistant creation of exports from the command line and bypasses the need for an editor. The option specifies a list of comma-separated options that describe how the pathname is exported. The set of available export options are detailed in the na_exports(5) man page.

-r
Reexports all entries in /etc/exports. Effectively, all exports not in /etc/exports are removed from memory and any changed entries in /etc/exports are reloaded.

-s
Determines the actual storage path of pathname. This functionality is useful primarily when the -actual option is applied to an export and the real path to the storage is desired.

-u
Unexports the specified path name. If you also include the -a option, the command unexports all the path names exported through the /etc/exports file and those exported through command line. In that case it ignores pathname.

-v
Prints each path name as it is exported or unexported.

-w
Prints all exports in memory to the file specified by pathname.

-o option
Specifies a list of comma-separated options that describe how a file or directory is exported. If the user wants these options to override what is in the /etc/exports file, then the -i option should be used in addition to -o. The set of available export options are detailed in the na_exports(5) man page.

COMMAND INTERACTIONS

As of ONTAP 6.5, when exportfs -a or exportfs -r is run, if an export in memory has not changed from the entry in the /etc/exports file, it is not reloaded. As duplicate advertised paths and file handles can occur in the file, the order they appear can effect whether an export is considered to have changed or not.

Note that if you flip the order of such duplicate rules in /etc/exports, then the expected export will change.

This functionality was added to mitigate the slight open window in which applications would recieve an ESTALE. Note that exportfs -au followed by exportfs -a will still reload the exports in memory.

EXAMPLES

In the following example, all network clients can mount the /vol/vol0/home directory but only the adminhost can mount the /vol/vol0 directory:

  exportfs -o rw=adminhost,root=adminhost /vol/vol0
  exportfs -o rw /vol/vol0/home

To make a persistant export:

  exportfs -p rw=adminhost,ro,anon=0 /vol/charts

Note that unlike the -o option, the -p option never needs the -i option specified to ignore export options specified in /etc/exports.

The following examples show different forms of the exportfs command that export the /vol/vol0/home directory to the 10.45.67.0 subnet with the 255.255.255.0 netmask:

  exportfs -o rw=10.45.67.0/24 /vol/vol0/home
  exportfs -o rw=10.45.67/24 /vol/vol0/home
  exportfs -o rw="network 10.45.67.0 netmask 255.255.255.0" \\
  /vol/vol0/home
  exportfs -o rw="10.45.67.0 255.255.255.0" /vol/vol0/home

Note that an implicit assumption in these examples was that /vol/vol0/home was not present in the /etc/exports file, otherwise the options present would have been ignored. To force the options on the command line, use -i:

  exportfs -i -o rw=10.45.67.0/24 /vol/vol0/home
  exportfs -o rw=10.45.67/24 -i /vol/vol0/home
  exportfs -io rw="network 10.45.67.0 netmask 255.255.255.0" \\
  /vol/vol0/home
  exportfs -i -o rw="10.45.67.0 255.255.255.0" /vol/vol0/home

We can also export to several different subnets, as shown by:

  exportfs -io \\
  rw=10.0.0.0/8:"network 172.28.2.0 netmask 255.255.255.0" \\
  /vol/vol0
  exportfs -io \\
  ro="network 172.28.2.0 netmask 255.255.255.0":"10.45.67.0 255.255.255.0" \\
  /vol/vol0/home

Also note that all of

  -i -o 
  -o  -i
  -io 

are legal, but the following combination is not:

  -oi 

If we export the a path using the -actual option:
  exportfs -o actual=/vol/vfilers/vf19,rw=pets,root=workers \\
  /vol/vol9/vf19

and at some later point we want to determine the actual path to storage, we can use -s to determine that information:

  > exportfs -s /vol/vol9/vf19
  /vol/vfilers/vf19
  > exportfs -s /vol/vol9/vf19/src
  /vol/vfilers/vf19/src

Remember that the -actual parameter allows for a server side aliasing of path names in the event that the storage has been moved and clients have not yet been updated to the new path.

If we then want to check to see if the client dog could mount this export, we would use -c:

  > exportfs -c 192.168.208.51 /vol/vfilers/vf19
  exportfs: 192.168.208.51 has mount access to /vol/vfilers/vf19

Note that as RPC requests come across the wire with IP addresses and not machine names, to test the algorithm to determine access, it is best to pass in the IP address and not the name.

Also, -c does not convert the path to the actual storage path, again because the RPC calls only reference the exported path name.

If a host has established a mount session for an export and is unable to either read, write, or have root permissions, you can further check such access:

  > exportfs -c 192.168.208.51 /vol/vfilers/vf19 root
  exportfs: 192.168.208.51 has root access to /vol/vfilers/vf19

Every NFS request that comes across the wire results in an access check. To reduce name resolution calls, an access cache is created to store a clients access rights for an export. Access cache entries expire as controlled by the options:

nfs.export.neg.timeout
dictates how long an entry which has been denied access lives

nfs.export.pos.timeout
dictates how long an entry which has been granted access lives

If a client's IP is changed and there is still a long time before an expunging occurs, the cache entry can be flushed from the access cache:

  > exportfs -f /vol/vfilers/vf19

If there has been a massive restructuring of the network architecture, all access cache entries may be flushed:

  > exportfs -f

If a flush is tried while an access cache entry is being utilized, a message will be reported:

  exportfs: Cache in use, please try again

If this message persists and the cache has to be flushed for new connections, then reloading the exports will force the cache to be reloaded:

  > exportfs /vol/vfilers/vf19

All of the entries can be forced to flush as well:

  > exportfs -a

Note that if -a is used, any exports loaded manually via the exportfs command will not be reloaded or flushed. These exports will have to be manually redone.

FILES

/etc/exports
directories and files exported to NFS clients
/etc/hosts
host name data base
/etc/netgroup
network groups data base

VFILER CONSIDERATIONS

When run from a vfiler context, (e.g. via the vfiler run command), exportfs operates on the concerned vfiler. The command fails if a path is specified, either on the command line or in /etc/exports, that does not belong to the concerned vfiler. All specified IP addresses are assumed to be in the concerned vfiler's ipspace.

SEE ALSO

na_vfiler(1) na_ipspace(1) na_exports(5), na_hosts(5), na_netgroup(5), na_options(1), na_passwd(5)

NOTES

Exporting the root volume as / can be misleading to some automounters.

To aid in debugging why a particular host can not mount an export, you can temporarily set nfs.mountd.trace to on. The resulting log messages can help you trace down access problems.

A common access problem is that a host does not have a reverse DNS entry and as such, the hostname for the incoming Internet address can not be determined. Either add the host's name to DNS or add an entry into the /etc/hosts file.

Prior to ONTAP 6.5, when an export was loaded into memory, the -rw= and -root= entries underwent name lookups and the results were permamently stored with the export. If the names were changed, then until the exports were reloaded, the old values were used. Starting with ONTAP 6.5, this preloading of names no longer occurs. As a result, name changes can occur after an access cache entry is purged. One thing to note here is that for DNS lookups, as the order in the search field is changed in /etc/resolv.conf, then non-FQDN names may resolve to different hosts.


Table of Contents