Do you know that systemd provides its own automount feature?
It is as simple as declaring your file system in /etc/fstab and adding the x-systemd.automount mount option:
[root@demo ~]# vi /etc/fstab ... nfs.example.com:/exports/docs /documents nfs x-systemd.automount 0 0 [root@demo ~]# mkdir /documents [root@demo ~]# reboot # or systemctl daemon-reload && systemctl start documents.automount
That's it. No need to install the autofs package, updating the /etc/auto.master file, or starting an extra service.
You can also add the x-systemd.idle-timeout option for systemd to unmount the file system when idle, and any other mount options the file system requires:
nfs.example.com:/exports/docs /documents nfs x-systemd.automount,x-systemd.idle-timeout=2min,rw,sync 0 0
See systemd.automount(5) and systemd.mount(5) man pages.
Does anyone know if the use of this setting conflicts with the normal legacy automounter? Is it like chrony and ntp where you need to choose one or the other but not both? I have not seen this in practice, only the old school methods.
That's pretty nifty.
This would beat the heck out of teaching autofs to students. The concepts of master map, indirect map, and direct map files is a big issue with new-to-autofs students.
(As it is a section in RH134, autofs will still be taught to my students)
I wonder what kind of automount it is: is it equivalent to a direct mount (the mount point must exist and the mounted directories exist upon entering the mount point) or an indirect mount (the mount point is created on demand and the mounted directories are only mounted when accessed)?
Gotta play around with this