Automount
used to automatically mount devices/shares
2 types of automapping direct and indirect.
direct mount | is when a file system mounts to an unchanging, known mount point location. Almost all the file system mounts that you configured, |
---|---|
indirect | is when the mount point location is not known until the mount demand occurs. An example of an indirect mount is the configuration for remote-mounted home directories, where a user's home directory includes their username in the directory path |
to use
Need to install
dnf install autofs nfs-utils
this includes a service that needs to be started
systemctl enable --now autofs
Need to create 2 files one is a master file that sits in the autofs dropin directory /etc/auto.master.d/
This file contains details of mount place and the direct map file
example /etc/auto.master.d/direct.autofs which just has
/- /etc/auto.direct
note the /- is used to specify same directory as on sharing server
for the second file The mapping file-naming convention is /etc/auto.name, where name reflects the content of the mapdirect map file for example /etc/auto.direct that would have
/external -rw,sync,fstype=nfs4 serverb:/shares/direct/external
Has 3 main components
subdirectory of local mount | mount options | share location |
---|---|---|
work | -rw,sync | serverb:/shares/work |
Known as the key in the man pages, the autofs service automatically creates and removes the mount point. In this case, the fully qualified mount point is /shares/work (see the master map file). The autofs service creates and removes the /shares and /shares/work directories as needed.
For indirect
subdirectory of local mount | mount options | share location |
---|---|---|
* | -rw,sync | serverb:/shares/& |
The mount point (or key) is an asterisk character (*), and the subdirectory on the source location is an ampersand character (&). Everything else in the entry is the same.
When a user attempts to access /shares/work, the * key (which is work in this example) replaces the ampersand in the source location and serverb:/exports/work is mounted. As with the indirect example, the autofs service creates and removes the work directory automatically.