autofs mounting local filesystems by label
previously: https://wibblement.blogspot.com/2023/05/minimal-automounter-config-for-linux.html
There are a couple of oddities around configuring a direct autofs map.
To mount by label, the entry in the direct map looks like:
/wibble -fstype=auto LABEL=ythh0
If the middle field is ommitted, then it defaults to trying to treat it as NFS.
The order is opposite to fstab(5), which has the device first, and then the mount point.
The automounter will make the mount appear at the location whether the mount point exists as a directory or not. This is different semantics from mount(8) / fstab(5), which require that the mount point exists.
If you need to troubleshoot, you can set "logging = verbose" in the "[ autofs ]" section of /etc/autofs.conf and restart autofs. autofs.conf is by default in debian a vast commented-out file, with about 3 lines not commented out. Better to remove all the commented lines, and just keep the effective ones.
Thus, the revised example from before becomes:
Install package autofs (debian). Sadly, installing it also presumes to enable and start the service.
/etc/autofs.conf refers to /etc/auto.master; optionally de-comment /etc/autofs.conf to leave something like (debian 12):
[ autofs ]
master_map_name = /etc/auto.master
timeout = 300
In /etc/auto.master:
/- auto.direct
Comments
Post a Comment