NFS mount using autofs

I’ve got an NFS share I’m trying to mount with autofs (on Fedora 34).

The share itself seems to work fine; i.e., this works:

$ sudo mount myserver:/store/share /mnt

…and ls /mnt will show the expected file list.

So, I’ve done the following:

$ cat /etc/auto.master.d/share.autofs
/share /etc/auto.share

$ cat /etc/auto.share
share	-fstype=nfs4	myserver:/store/share

But after I restart autofs:

$ ls /share

…shows nothing. (That is, the mount point has been created, but none of the files appear.)

The most mystifying part of this (to me) is that I’ve similarly configured NFS-mounted home directories from the same server, and that is working fine:

$ cat /etc/auto.master.d/home.autofs 
/home	/etc/auto.home

$ cat /etc/auto.home
*	-fstype=nfs4	myserver:/store/home/&

Any idea what might be going on here?

Try ls /share/share

Ahem. That worked.

So, how do I get the actual mount point to be /share? (Changing /etc/auto.master.d/share.autofs to / /etc/auto.share didn’t seem to do the trick.)

I get the impression that to do this, I must use what autofs calls a “direct mount”. So, this seems to work:

$ cat /etc/auto.master.d/share.autofs
/-	/etc/auto.share
$ cat /etc/auto.share
/share	-fstype=nfs4	myserver:/store/share
1 Like