linux automount的configuration在哪里?

我有一个centos盒子,它有一些NFS挂载。 我试图找出这些NFS文件系统挂载。 我想通过重新命名/ usr / sbin / automount到其他名字,这些NFS将不会被挂载。 所以我可以肯定的是,自动挂载这些NFS挂载。

但是/etc/auto.master没有显示这些NFS的信息。 我想知道有多大的可能性,关于如何automount如何NFS挂载?

$ cat /etc/auto.master # # Sample auto.master file # This is an automounter map and it has the following format # key [ -mount-options-separated-by-comma ] location # For details of the format look at autofs(5). # /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 # # Include central master map if it can be found using # nsswitch sources. # # Note that if there are entries for /net or /misc (as # above) in the included master map any keys that are the # same will not be seen as the first read key seen takes # precedence. # +auto.master 

但是在/var/run ,我find如下的东西:

 prw------- 1 root root 0 Jan 20 04:36 autofs.fifo-bldmnt prw------- 1 root root 0 Jan 20 04:36 autofs.fifo-blr 

文件auto.master通常包含这一行:

 /net -hosts 

一个更老的select是(是):

 /net /etc/auto.net 

第一行是所谓的内build映射,指的是文件/ etc / hosts,第二个例子是一个所谓的程序映射(通常是一个简单的shell脚本),它可以更好地向您解释automounter是如何工作的。

我想你的系统上有一些符号链接指向/net下的远程服务器上的某个path(或者在/etc/auto.master的副本中使用autofspath前缀而不是/ net)。

每当访问/net锚点下方的path时,自动挂载机会捕获此尝试并尝试在此处挂载引用的目录。

例:

假设自动挂载程序正在运行,并且在networking中存在名为HostA的NFS服务器,该服务器在其/etc/exports文件中/etc/exports名为Documents的目录。 然后使用该命令

 cd /net/HostA/Documents 

可以自动挂载这个远程目录,而无需在NFS客户端进一步configuration。

内幕:

与其他服务一样,automount使用命名pipe道进行某些内部进程间通信。 因此,在问题中提到的/var/run/中的文件是由automount进程为此目的创build的,然后才能真正安装任何东西。

在autofs软件包的早期版本中,/ kshowmount --no-headers -e是一个脚本,它调用命令showmountkshowmount --no-headers -e NFS-SERVER来从NFS服务器获取导出文件系统的列表。

showmount在客户端上显示服务器端文件/etc/exports定义的目录。 这个文件可能包含目录/ 。 但是由于安全问题,这从来都不是我见过的任何Linux发行版的默认设置。

我们有几个RHEL6系统,它应该和某些类似于centOS的机器类似。 我们的服务器设置在/ etc / exports中

 /data/nfs <IP-Range>(rw,sync,insecure,root_squash,no_subtree_check,fsid=0) /data/nfs/data <IP-Range>(rw,nohide,sync,insecure,root_squash,no_subtree_check) 

并在客户端设置在/ etc / fstab中

 <Hostname of NFS-Server>:/data /data/<mount-directory> nfs4 rw 0 0