autofs 中文man页面

系统
automounter maps 是一系列非主映射文件或者是NIS映射(NIS maps),它们被 automounter 的主映射文件(master map)具体调用(参看 auto.master(5))。 automounter maps 具体描述了在主映射文件(auto.master)中的列出挂载点是如何被挂载的。这份文档只涉及类似于 sun 系统 下的非主映射文件格式; 如果指定了其它的格式 (例如:hesiod),那么这份文档就不适用了。这些非主映射文件都能被修改而且 automounter 会在下一次处理这些映射文件时马上认出它们。但是主映射文件 auto.master 做不到这一点。

名称(NAME)

autofs - automounter maps的格式  

描述(DESCRIPTION)

automounter maps 是一系列非主映射文件或者是NIS映射(NIS maps),它们被 automounter 的主映射文件(master map)具体调用(参看 auto.master(5))。 automounter maps 具体描述了在主映射文件(auto.master)中的列出挂载点是如何被挂载的。这份文档只涉及类似于 sun 系统 下的非主映射文件格式; 如果指定了其它的格式 (例如:hesiod),那么这份文档就不适用了。这些非主映射文件都能被修改而且 automounter 会在下一次处理这些映射文件时马上认出它们。但是主映射文件 auto.master 做不到这一点。  

格式(FORMAT)

这仅仅是该文本文件的一种格式,也许还存在其它的格式。所有的空行和以“#”字符开始的行都会被忽略掉。在一个映射文件中每一行的基本格式看起来如下: key [-options] location

key

是目录名的一部分,位于挂载点和被挂载的文件系统路径之间。通常你可以把“key”看作为一个位于挂载点下的子目录。  

options

options是可选的。它也能够在 auto.master 中明确的给出。如果那样的话,两个选项能叠加起来(这一点与SunOS有所不同)。options是一组与 mount(8) 命令中的选项一样的列表,以逗号分隔。不过,有个特殊选项 -fstype= ,它被用于指定一个文件系统的类型(如果要挂载的文件系统不是NFS的话)。这个特殊选项只能由 automounter来处理,mount是不能用的。(注:automounter通常用于NFS卷的自动挂载,但也可以用来在开机时挂载用户自己的硬盘。个人感觉比在fstab中直接写要方便。大家见仁见智,自选吧)  

location

location指明将要挂载的文件系统是从哪来的。绝大多数情况下这将是个NFS卷,通常用 host:pathname 来指出将被挂载的远程文件系统和路径。如果要被挂载的文件系统是以“/”开头的(例如本地文地文件系统 /dev 或者是一个smb文件共享),那就需要在前面加一个“:”(例如 :/dev/sda1)。  

范例

kernel    -ro,soft,intr       ftp.kernel.org:/pub/linux
boot      -fstype=ext2        :/dev/hda1
windoze   -fstype=smbfs       ://windoze/c
removable -fstype=ext2        :/dev/hdd
cd        -fstype=iso9660,ro  :/dev/hdc
floppy    -fstype=auto        :/dev/fd0

第一行,我们把一个来自 ftp.kernel.org 的内核目录挂载为远程NFS卷。这是只读安装。第二行挂载了一个本地ide磁盘上的ext2分区。第三行挂载了一个Windows系统上的samba共享目录。剩下的应该是不言而喻的了。  

特性(FEATURES)

映射替换(Map Key Substitution)

location 里的“&”字符可被用来代替 key 值,“&”会被自动展开为跟 key 一样的值 (这个字符可能只有必要和下面的通配符一起用)  

通配符(Wildcard Key)

key 里的“*“字符可匹配所有的key。下面是个很有用的范例:

*         &:/home/&

这使你能够以 /mountpoint/hostname/local-path 这种方式进入所有本地主机的主目录。  

变量替换(Variable Substitution)

下列这些特殊变量若出现在key或location中并且前面有个”$“,就能被相应的内容替换,就像是在 shell脚本里一样。可以用一对”{ }“ (curly braces)来分隔”字段名“(fieldname)

ARCH           Architecture (uname -m)
CPU            Processor Type
HOST           Hostname (uname -n)
OSNAME         Operating System (uname -s)
OSREL          Release of OS (uname -r)
OSVERS         Version of OS (uname -v)

automount(8) -D variable=Value 还能定义更多的替换项。  

可执行的映射(Executable Maps)

一个映射能被标记为可执行。传递主映射文件(auto.master)的初始化脚本会把这个可执行映射作为一个 程序映射 送给automounter。 程序映射 将会像一个shell脚本那样被执用,”key“作为参数。如果找不到key,脚本会只输出脚本文件的一行或者干脆什么都没有。 要想像上面这么做的话, automount(8) daemon 必须以程序形式起动,而不是以文件形式。在automount的初始化脚本里包含有这条设定。 一个可执行的映射能返回一个错误代码来指出错误,或者什么都不显示。所有送到标准错误输出的内容都被系统日志记录在案。  

不支持的功能(UNSUPPORTED)

automounter不支持直接挂载(注:实用时发现automount必须要有一个key才行,如果省略的话就不能安装成功)或是挂载树(用一个指定的自动挂载点来挂装超过一个文件系统),以及不支持处理 SunOS类型的可复用文件系统(replicated filesystem)。这只有 mount(8) 才支持。  

参看(SEE ALSO)

automount(8), auto.master(5), autofs(8), mount(8).  

#p#

NAME

autofs - Format of the automounter maps  

DESCRIPTION

The automounter maps are files or NIS maps referred to by the master map of the automounter (see auto.master(5)). The automounter maps describe how file systems below the mountpoint of the map (given in the auto.master file) are to be mounted. This describes the sun map format; if another map format is specified (e.g. hesiod), this documentation does not apply.

Maps can be changed on the fly and the automouter will recognize those changes on the next operation it performs on that map. This is not true for the auto.master map!  

FORMAT

This is a description of the text file format. Other methods of specifying these files may exist. All empty lines or lines beginning with # are ignored. The basic format of one line in such maps is: key [-options] location

key

For indirect mounts this is the part of the pathname between the mountpointi and the path into the filesystem mounted. Usually you can think about the key as a subdirectory name below the mountpoint.

For direct mounts this is the full path of the mountpoint. This map is always associated with the /- mountpoint in the master map.

options

Options are optional. Options can also be given in the auto.master file in which case both values are cumulative (this is a difference from SunOS). The options are a list of comma separated options as customary for the mount(8) command. There are two special options -fstype= used to specify a filesystem type if the filesystem is not of the default NFS type. This option is processed by the automounter and not by the mount command. -strict is used to treat errors when mounting file systems as fatal. This is important when multiple file systems should be mounted (`multimounts'). If this option is given, no file system is mounted at all if at least one file system can't be mounted.

location

The location specifies from where the file system is to be mounted. In the most cases this will be an NFS volume and the usual notation host:pathname is used to indicate the remote filesystem and path to be mounted. If the filesystem to be mounted begins with a / (such as local /dev entries or smbfs shares) a : needs to be prefixed (e.g. :/dev/sda1).  

EXAMPLE

kernel    -ro,soft,intr       ftp.kernel.org:/pub/linux
boot      -fstype=ext2        :/dev/hda1
windoze   -fstype=smbfs       ://windoze/c
removable -fstype=ext2        :/dev/hdd
cd        -fstype=iso9660,ro  :/dev/hdc
floppy    -fstype=auto        :/dev/fd0
server    -rw,hard,intr       / -ro myserver.me.org:/ \
                              /usr myserver.me.org:/usr \
                              /home myserver.me.org:/home

In the first line we have a NFS remote mount of the kernel directory on ftp.kernel.org. This is mounted read-only. The second line mounts an ext2 volume on a local ide drive. The third makes a share exported from a Windows machine available for automounting. The rest should be fairly self-explanatory. The last entry (the last three lines) is an example of a multi-map (see below).

If you use the automounter for a filesystem without access permissions (like vfat), users usually can't write on such a filesystem because it is mounted as user root. You can solve this problem by passing the option gid=<gid>, e. g. gid=floppy. The filesystem is then mounted as group floppy instead of root. Then you can add the users to this group, and they can write to the filesystem. Here's an example entry for an autofs map:

floppy-vfat  -fstype=vfat,sync,gid=floppy,umask=002  :/dev/fd0

FEATURES

Map Key Substitution

An & character in the location is expanded to the value of the key field that matched the line (which probably only makes sense together with a wildcard key).  

Wildcard Key

A * in the key field of indirect maps matches all keys. An example for the usefulness is the following entry:

*         &:/home/&

This will enable you to access all the home directory of local hosts using the path /mountpoint/hostname/local-path.  

Variable Substitution

The following special variables will be substituted in the key and location fields of an automounter map if prefixed with $ as customary from shell scripts (Curly braces can be used to separate the fieldname):

ARCH           Architecture (uname -m)
CPU            Processor Type
HOST           Hostname (uname -n)
OSNAME         Operating System (uname -s)
OSREL          Release of OS (uname -r)
OSVERS         Version of OS (uname -v)

Additional entries can be defined with the -Dvariable=Value map-option to automount(8).  

Executable Maps

A map can be marked as executable. The init script that parses the auto.master map will pass this as a program map to the automounter. A program map will be called as a script with the key as an argument. It may return no lines of output if there's an error, or one or more lines containing a map (with \ quoting line breaks). To use a program map, the automount(8) daemon has to be started with the program type instead of the file type. This is implemented in the initialization script. A executable map can return an errorcode to indicate the failure in addition to no output at all. All output sent to stderr is logged into the system logs.  

Multiple Mounts

A multi-mount map can be used to name multiple filesystems to mount. It takes the form:

key [-options] [mountpoint [-options] location...]...

This may extend over multiple lines, quoting the line-breaks with `\'. If present, the per-mountpoint mount-options are appended to the default mount-options.  

Replicated Server

Multiple replicated hosts, same path:
<path> host1,host2,hostn:/path/path

Multiple hosts, some with same path, some with another
<path> host1,host2:/blah host3:/some/other/path

Multiple replicated hosts, different (potentially) paths:
<path> host1:/path/pathA host2:/path/pathB

Mutliple weighted, replicated hosts same path:
<path> host1(5),host2(6),host3(1):/path/path

Multiple weighted, replicated hosts different (potentially) paths:
<path> host1(3):/path/pathA host2(5):/path/pathB

Anything else is questionable and unsupported, but these variations will also work:
<path> host1(3),host:/blah

UNSUPPORTED

This version of the automounter supports direct maps for FILE, NIS and LDAP maps only and handles SunOS-style replicated filesystems only to the extent that mount(8) does.  

CAVEATS

Unlike Sun's multi-mount syntax, the mountpoint is mandatory for all mounts.  

SEE ALSO

automount(8), auto.master(5), autofs(8), mount(8).  

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

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-12 14:58:05

killall中文man

2011-07-15 16:58:36

ac中文man

2011-08-15 11:10:48

more中文man

2011-08-25 17:03:51

pclose中文man

2011-08-15 14:10:37

tar中文man

2011-08-16 10:42:30

rmmod中文man

2011-08-11 17:46:02

chmod中文man

2011-08-18 13:57:38

acct中文man

2011-08-23 17:49:36

zdump中文man

2011-08-15 15:10:49

wall中文man

2011-08-12 13:26:56

groff中文man

2011-08-25 11:39:13

tzfile中文man

2011-08-23 15:22:52

rootflags中文man

2011-08-23 15:06:03

quotastats中文man

2011-08-15 17:35:50

ar中文man

2011-08-25 09:07:16

suffixes中文man
点赞
收藏

51CTO技术栈公众号