exportfs 中文man页面

系统
exportfs 命令用来管理当前NFS共享的文件系统列表。这个列表保存在一个单独的文件 /var/lib/nfs/xtab 中,当远端主机要求对一个文件系统树加载并访问时由 mountd 读取,列表中活动的一部分也保存在在内核共享表中。 通常 xtab 在执行 exportfs -a. 的时候,根据 /etc/exports 中定义的共享列表来初始化。但是,管理员可以选择添加或删除独立的文件系统,不必修改 /etc/exports ,只要执行 exportfs 就可以了。

名称 (NAME)

exportfs - 管理NFS共享文件系统列表  

概述 (SYNOPSIS)

/usr/sbin/exportfs [-avi] [-o options,..] [client:/path ..]
/usr/sbin/exportfs -r [-v]
/usr/sbin/exportfs [-av] -u [client:/path ..]
/usr/sbin/exportfs [-v]
/usr/sbin/exportfs -f
 

描述 (DESCRIPTION)

exportfs 命令用来管理当前NFS共享的文件系统列表。这个列表保存在一个单独的文件 /var/lib/nfs/xtab 中,当远端主机要求对一个文件系统树加载并访问时由 mountd 读取,列表中活动的一部分也保存在在内核共享表中。 通常 xtab 在执行 exportfs -a. 的时候,根据 /etc/exports 中定义的共享列表来初始化。但是,管理员可以选择添加或删除独立的文件系统,不必修改 /etc/exports ,只要执行 exportfs 就可以了。 exportfs 和它的合作者 mountd 工作在两种模式之一,一种是2.4以及早期的内核采用的传统模式,另一种是2.6以后内核采用的模式。 2.6之后的内核提供了 nfsd 虚拟文件系统,挂载点是 /proc/fs/nfs。 在2.6内核中如果没有挂载这个系统,将使用传统模式。 在新模式中, exportfs 不为内核提供任何信息,只通过 /var/lib/nfs/xtab 文件将信息提供给 mountd mountd 将等待内核请求,提供需要的信息。 在传统模式中,任何标识了一台特定主机(而不是一个子网或是一个工作组)的共享请求会直接进入内核共享表,同时写入 /var/lib/nfs/xtab. 甚至于,任何列在 /var/lib/nfs/rmtab 中的挂载点,只要它符合一个不指定主机的共享请求,将使得 rmtab 给出的主机的一个适当的共享条目进入内核的共享表中。  

选项 (OPTIONS)

-a
打开或取消所有目录共享。
-o options,...
指定一列共享选项,与 exports(5) 中讲到的类似。
-i
忽略 /etc/exports 文件,从而只使用默认的和命令行指定的选项。
-r
重新共享所有目录。它使 /var/lib/nfs/xtab 和 /etc/exports 同步。它将 /etc/exports 中已删除的条目从 /var/lib/nfs/xtab 中删除,将内核共享表中任何不再有效的条目移除。
-u
取消一个或多个目录的共享。
-f
在“新”模式下,刷新内核共享表之外的任何东西。任何活动的客户程序将在它们的下次请求中得到 mountd 添加的新的共享条目。
-v
输出详细信息。当共享或者取消共享时,显示在做什么。显示当前共享列表的时候,同时显示共享的选项。

讨论 (DISCUSSION)

共享目录 (Exporting Directories)

第一条概述中显示出如何执行命令来添加新的共享。当执行 exportfs -a时, 所有 exports(5) 中的目录将添加到 xtab 并且将结果列表送进内核。 host:/path 参数指定了要共享的目录和可以访问它的主机。所有 exports(5) 中定义的格式都可以支持。想要将一个目录共享给所有其他机器,只要用 :/path 就可以了。 这种指定一个特定主机/目录的共享选项来自于多种来源。有一系列的默认选项,可以在 /etc/exports 中指定它们(除非指定了 -i 选项)。另外,管理员可以使用 -o 参数和一系列以逗号分隔的选项来覆盖所有默认选项。做法就像在 exports(5) 中一样。因此, exportfs 可以用来修改已经共享的目录的共享选项。 nfsd(8) 对内核共享表的修改会在命令行解析和 xtab 文件修改之后马上进行。 默认的共享选项是 sync,ro,root_squash,no_delay。  

取消共享 (Unexporting Directories)

第三种语法显示了怎样取消一个当前的共享目录。当执行 exportfs -ua, 的时候, xtab 中的所有条目被从内核共享表中移除,这个文件会被清空。这样可以迅速停止所有NFS服务。 要取消单独的共享条目,可以指定一个 host:/path 参数。这样删除了 xtab 中的条目并且移除了对应的内核条目(如果有的话)。  

获取共享表 (Dumping the Export Table)

执行不带选项的 exportfs 将列出当前的共享列表。当给出 -v 选项时,会列出各自的标志。  

范例 (EXAMPLES)

这条命令将所有 /etc/exports 中列出的目录加入到 /var/lib/nfs/xtab 中,将结果送入内核:

# exportfs -a

如果要将 /usr/tmp 目录共享给 djando主机, 允许匿名写入,应当这样:

# exportfs -o async django:/usr/tmp

依赖性 (DEPENDENCIES)

提供给IP子网,DNS和NIS域的共享不会使这些工作组中的客户程序马上就能读取NFS;这种类型的共享其实是向 mountd(8) 提供的信息,为来自这些客户的挂载请求授权。这通常不是一个大问题,因为重启过程中,任何存在的加载都保存在 rmtab 中。 当取消一个子网或域的共享时,当前任何提供给这个工作组中的成员的共享将被检查。如果它们不再有效,它们将被移除。  

参见 (SEE ALSO)

exports(5), mountd(8)  

#p#

NAME

exportfs - maintain list of NFS exported file systems  

SYNOPSIS

/usr/sbin/exportfs [-avi] [-o options,..] [client:/path ..]
/usr/sbin/exportfs -r [-v]
/usr/sbin/exportfs [-av] -u [client:/path ..]
/usr/sbin/exportfs [-v]
/usr/sbin/exportfs -f
 

DESCRIPTION

The exportfs command is used to maintain the current table of exported file systems for NFS. This list is kept in a separate file named /var/lib/nfs/xtab which is read by mountd when a remote host requests access to mount a file tree, and parts of the list which are active are kept in the kernel's export table. Normally this xtab file is initialized with the list of all file systems named in /etc/exports by invoking exportfs -a. However, administrators can choose to add and delete individual file systems without modifying /etc/exports using exportfs. exportfs and it's partner program mountd work in one of two modes, a legacy mode which applies to 2.4 and earlier versions of the Linux kernel, and a new mode which applies to 2.6 and later versions providing the nfsd virtual filesystem has been mounted at /proc/fs/nfsd or /proc/fs/nfs. If this filesystem is not mounted in 2.6, the legacy mode is used. In the new mode, exportfs does not give any information to the kernel but only provides it to mountd through the /var/lib/nfs/xtab file. mountd will listen to requests from the kernel and will provide information as needed. In the legacy mode, any export requests which identify a specific host (rather than a subnet or netgroup etc) are entered directly into the kernel's export table as well as being written to /var/lib/nfs/xtab. Further, any mount points listed in /var/lib/nfs/rmtab which match a non host-specific export request will cause an appropriate export entry for the host given in rmtab to be entered into the kernel's export table.  

OPTIONS

-a
Export or unexport all directories.
-o options,...
Specify a list of export options in the same manner as in exports(5).
-i
Ignore the /etc/exports file, so that only default options and options given on the command line are used.
-r
Reexport all directories. It synchronizes /var/lib/nfs/xtab with /etc/exports. It removes entries in /var/lib/nfs/xtab which are deleted from /etc/exports, and remove any entries from the kernel export table which are no longer valid.
-u
Unexport one or more directories.
-f
In 'new' mode, flush everything out of the kernels export table. Any clients that are active will get new entries added by mountd when they make their next request.
-v
Be verbose. When exporting or unexporting, show what's going on. When displaying the current export list, also display the list of export options.

DISCUSSION

Exporting Directories

The first synopsis shows how to invoke the command when adding new entries to the export table. When using exportfs -a, all directories in exports(5) are added to xtab and the resulting list is pushed into the kernel. The host:/path argument specifies the directory to export along with the host or hosts to export it to. All formats described in exports(5) are supported; to export a directory to the world, simply specify :/path. The export options for a particular host/directory pair derive from several sources. There is a set of default options which can be overridden by entries in /etc/exports (unless the -i option is given). In addition, the administrator may overide any options from these sources using the -o argument which takes a comma-separated list of options in the same fashion as one would specify them in exports(5). Thus, exportfs can also be used to modify the export options of an already exported directory. Modifications of the kernel export table used by nfsd(8) take place immediately after parsing the command line and updating the xtab file. The default export options are sync,ro,root_squash,no_delay.  

Unexporting Directories

The third synopsis shows how to unexported a currently exported directory. When using exportfs -ua, all entries listed in xtab are removed from the kernel export tables, and the file is cleared. This effectively shuts down all NFS activity. To remove individial export entries, one can specify a host:/path pair. This deletes the specified entry from xtab and removes the corresponding kernel entry (if any).  

Dumping the Export Table

Invoking exportfs without further options shows the current list of exported file systems. When giving the -v option, the list of flags pertaining to each export are shown in addition.  

EXAMPLES

The following adds all directories listed in /etc/exports to /var/lib/nfs/xtab and pushes the resulting export entries into the kernel:

# exportfs -a

To export the /usr/tmp directory to host djando, allowing asynchronous writes, one would do this:

# exportfs -o async django:/usr/tmp

DEPENDENCIES

Exporting to IP networks, DNS and NIS domains does not enable clients from these groups to access NFS immediately; rather, these sorts of exports are hints to mountd(8) to grant any mount requests from these clients. This is usually not a big problem, because any existing mounts are preserved in rmtab across reboots. When unexporting a network or domain entry, any current exports to members of this group will be checked against the remaining valid exports and if they themselves are nolonger valid they will be removed.  

SEE ALSO

exports(5), mountd(8)  

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man

2011-08-23 15:39:34

rpmbuild中文man

2011-08-24 15:48:38

INSERT中文man
点赞
收藏

51CTO技术栈公众号