I have a centos box, it has some NFS mounts. I'm trying to figure out these NFS filesystems get mounted. And I figured out if I rename /usr/sbin/automount to some else name, after reboot the box, those NFS will not be mount. So I can be sure that automount does those NFS mounts.
But /etc/auto.master show nothing about those NFS's info. I wonder what possibilities there could be about how automount how which NFS to mount?
$ 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
But under /var/run
, I find somethings like the following:
prw------- 1 root root 0 Jan 20 04:36 autofs.fifo-bldmnt
prw------- 1 root root 0 Jan 20 04:36 autofs.fifo-blr
Best Answer
The file auto.master usually contains this line:
An older alternative is (was):
The first line is the so called builtin map referring to the file /etc/hosts and the second example is a so called program map (usually a simple shell script), which may better explain to you how the automounter works.
I guess you have some symbolic links on your system pointing to some path on remote servers under
/net
(or whatever autofs path prefix is used instead of /net in your copy of the/etc/auto.master
).Whenever a path below the
/net
anchor is visited the automounter catches this attempt and tries to mount the referenced directory there.Example:
Assume the automounter is running and in the network there exists a NFS server named
HostA
which exports a directory namedDocuments
in his/etc/exports
file. Then using the commandcan automatically mount this remote directory there without further configuration on the NFS client.
Internals:
Like other services automount uses named pipes for some internal interprocess communication. So the files in
/var/run/
mentioned in the question are created by the automount process for this purpose prior to really mounting anything.In early versions of the autofs package
/etc/auto.net
was a script which calls the commandshowmount
orkshowmount --no-headers -e
NFS-SERVER to obtain a list of exported filesystems from the NFS server.showmount
on the client displays the directories defined in the file/etc/exports
on the server side. This file might contain the directory/
. But due to security concerns this was never the default on any Linux distribution I've ever seen.