I haven't used autofs in years but am looking at it to deploy at work.
While setting things up on rocky9 linux I noticed some odd behaviour that I wasn't able to confirm is normal, novel or broken. I don't recall it working this way. Any comments would be appreciated, thanks!
In short, if I access a non-existant directory under the map, it lists and mounts all directories at mnt/projects instead of throwing an error.
[root@lnx-greg ~]# ls /mnt/
editorial library projects
[root@lnx-greg ~]# ls /mnt/projects
<-- expected to see nothing as i didn't select a sub directory such as "alone"...
[root@lnx-greg ~]# ls /mnt/projects/foobarabcxyz
alone bbb cdl die gdt home monster pipe_test tamarack training yellowstone
[root@lnx-greg ~]# df
__SNIP__
10.2.0.204:/projects _snip_ /mnt/projects/foobarabcxyz
[root@lnx-greg ~]# ls /mnt/projects/foobarabcxyz/
alone bbb cdl die gdt home monster pipe_test tamarack training yellowstone
[root@lnx-greg ~]# cat /etc/auto.projects
* -fstype=nfs,rw,vers=3,sec=sys,noatime,tcp,nolock,hard,intr qumulo.eng.company.com.:/projects
[root@lnx-greg ~]# cat /etc/auto.master.d/projects.autofs
/mnt/projects /etc/auto.projects
thanks in advance.
-greg
Hi @greg_905,
I'm no automount master. But I would expect that ls /mnt/projects/foobarabcxyz
would cause automount to mount /mnt/projects/foobarabcxyz
so that the ls
could run.
The subsequent df
shows that /mnt/projects/foobarabcxyz
is mounted as I'd expect.
Regarding "lists ... all directories" I think there are some mount options that control listing possible things to mount. "no browse" or something like that comes to mind.
I may be wrong, but I don't see anything in your output that seems unexpected to me.
In autofs browse mode
ls -l /mnt/projects
will show unmounted directories with arbitrary attributes.
If you don't want that, use nobrowse
option in auto.master (it is a map option applied to the autofs map, while mount options are passed to the mount call).
An access to /mnt/projects/
(with a trailing /
) forces the kernel to examine it, and will foster the mounts that are given as index, left column in the indirect map. But the *
wildcard index is special, nothing can be retrieved, nothing is mounted.
An access to /mnt/projects/nonexistent
should log an error and not foster any mounts.
If you see that it fosters mounts, and there is a *
index in the map, then the only explanation is the automount client cache ("map entry cache") that remembers all previous mounts. This client cache seems to exist in Linux autofs v5, and is not in the original Solaris autofs. I smell a bug here.
3 Likes
Thanks DrScriptt - that was a bogas directory. anything you 'cd' into would mount the export defined. example, cd /mnt/projects/hello.world would also mount 10.2.0.204:/projects there. but thanks much for the reply!
-greg
1 Like
MadeinGermany, did you write all those o'reilly books I use to read? I hope someone is paying you well. :). The nobrowse worked but I decided to use explicit keys ( projects -fstype=......) which also seemed to stop that nonsence.
thanks again for your input, appreciate it!
-greg