This is my first nfs / autofs configuration, so I probably configured something wrong. When I navigate to directory, which I added to /etc/auto.master I can't see any mount points, but when I issue cd with full path to expected mount point, than it tunes out, that I can access it. I think, that outputs below are self explanatory:
user@user-desktop:~/mnt/shares/autofs$ ls
user@user-desktop:~/mnt/shares/autofs$ ls ./backup_tmp
lost+found test.file
This is how /etc/auto.master file looks like (on the receiver machine). First two lines comes by default, so I was not sure if I should touch them:
+dir:/etc/auto.master.d
+auto.master
/home/user/mnt/shares/autofs /etc/auto.misc --timeout=20
And this is how /etc/auto.misc looks like (first line comes by default):
cd -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
data_archive -fstype=nfs4 192.168.1.140:/mnt/data_archive
data_file-resources -fstype=nfs 192.168.1.140:/mnt/data_file-resources
backup_tmp -fstype=nfs 192.168.1.140:/mnt/backup_tmp
Can anyone please help me debug this problem?
That's how autofs is supposed to work. The autofs directories are mounted when they are first accessed (that's why there is "auto" in the name). When you do a
ls
of the parent directory, there is no system call that would access the actual mountpoint path, so they are not visible. When you access explicitly the mountpoint path, it gets mounted. Try to dols
of the parent directory again, and you'll see that the mountpoint has appeared. After the mounted directory is not used by any process for 20 seconds (that's the timeout you have set in the config file), it gets unmounted again and is not visible anymore.This is by design, but autofs provides ways to change this behavior.
You can use the
browse
option, which only applies to particular entries in your autofs maps, or thebrowse_mode
option, which is system-wide.Option 1: Add the
browse
option in your/etc/auto.master
map:From
man auto.master
:Option 2: Change the value of
browse_mode
in/etc/autofs.conf
.From
man autofs.conf
:These man page excerpts are from Ubuntu 20.04, so it is possible that your system's version of autofs differs slightly in config file location or default configuration.