automount with autofs setup but not working

Again I am stuck with setting up auto-mounting with autofs. As i tried this a few times before I stayed with mounting manually when I needed access but i am fedup mounting manually so, here I go again trying to get this to work.

I have looked through a bunch of tutorials, as well as my old and similar question but I can't get it to work.

The most helpfull for me was:

When I mount manually is use the following, which works like a charm:

sudo mount -t nfs 192.168.1.100:/volume2/Files /mnt/nas

For the autofs setup I did the following:

sudo apt-get install autofs
sudo nano /etc/auto.master

and added at the end and saved:

/nas /etc/auto.nfs
sudo nano /etc/auto.nfs

added and saved:

/nas -fstype=nfs4 192.168.1.100:/volume2/Files

then:

sudo service autofs reload
sudo service autofs status

output:

● autofs.service - Automounts filesystems on demand Loaded: loaded (/lib/systemd/system/autofs.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2021-04-03 17:41:34 CEST; 26min ago Docs: man:autofs(8) Process: 1426 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /var/run/autofs.pid (code> Process: 6599 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS) Main PID: 1434 (automount) Tasks: 4 (limit: 37960) Memory: 2.7M CGroup: / └─1434 /usr/sbin/automount --pid-file /var/run/autofs.pid
apr 03 17:41:34 pop-os systemd[1]: Starting Automounts filesystems on demand...
apr 03 17:41:34 pop-os systemd[1]: Started Automounts filesystems on demand.
apr 03 18:08:05 pop-os systemd[1]: Reloading Automounts filesystems on demand.
apr 03 18:08:05 pop-os systemd[1]: Reloaded Automounts filesystems on demand.

which seems a good output. Still when I open /nas, the shared nas folder is not mounted.

Any thoughts on where I am going wrong would be very much appreciated.

ps: I used /nas instead of /mnt/nas as that one was already "used" by the manual mount although not this boot session.I also tried /mnt/nas too as that folder is already existing anyways so. I also rebooted. All still to no avail.

1 Answer

I had the same trouble starting autofs. Finally, I could solve it by just specifying a relative path instead of an absolute path in auto.fs. So, your files should look something like

auto.master

...
/mypoint /etc/auto.nfs

auto.nfs

myfiles -fstype=nfs4 192.168.1.100:/volume2/Files

The result will be that your files will be under /mypoint/myfiles

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like