最近测试一了一下autofs的功能:
NFS server端共享:
# showmount -e HPC_head
Export list for HPC_head:
/home *
/share *
客户端系统:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.6 (Tikanga)
客户端安装: autofs-5.0.1-0.rc2.143.el5_5.6
客户端配置原始文件内容:
# cat /etc/auto.master:
#
/misc /etc/auto.misc
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
#
+auto.master
===================================================================
---> 开始配置文件"/etc/auto.master", 内容如下:
/net /etc/auto.net --timeout 60
#
+auto.master
另外在查看相关资料时,还有几个疑问,希望大家帮忙解答: a.) 上面"/etc/auto.master"原始文件中"+auto.master"的作用是是么?(在man 5 autofs中没有给出解释) b.) 在man 5 autofs中有关于"*"、"&"的使用,不知该如何使用? c.) 另外,man 5 autofs 中关于"Replicated Server"(重复的服务主机???),是什么意思呢?该如何使用?
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 d.) 最后再man 5 autofs中提到内部变量替换"Variable Substitution"和通过"automount -Dvariabl=value"的方式来定义变量
不知这些变量如何使用,在什么地方能用到它们呢?
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 field name):
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)