LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mageia (https://www.linuxquestions.org/questions/mageia-97/)
-   -   How to use autofs to mount a NFS share (https://www.linuxquestions.org/questions/mageia-97/how-to-use-autofs-to-mount-a-nfs-share-4175608870/)

apimente.br 06-29-2017 08:26 PM

How to use autofs to mount a NFS share
 
I can not run the automatic mount for the following case:
- I have a mini NFS server where I store files mainly for back up purposes, I put in the /etc/fstab the mount configuration and everything worked fine. But if I'm not in my network (it is a notebook) the boot takes an eternity due the attempts to find the server.
- removed from /etc/fstab and started to mount and dismount manually when needed. This also works.
- I want to do something more automatic, searching I found the autofs that if it worked would be the solution to my problems. I read the man pages and saw how to do the setup.

But it does not work.

My /etc/autofs/auto.master:
Code:

cat auto.master
# Cubietruck
#
/media/NFS  /etc/autofs/auto.cubie  --timeout=60

My /etc/autofs/auto.cubie:
Code:

cat auto.cubie
# Cubietruck
/media/NFS  -fstype=nfs,rw,nosuid,nodev  :cubietruck:/media/hd/FS-01/

Code:

systemctl status  autofs.service
● autofs.service - Automounts filesystems on demand
  Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; vendor preset: enabled)
  Active: active (running) since Qui 2017-06-29 14:15:18 -03; 21min ago
  Process: 2527 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS) 
Main PID: 2535 (automount) 
  CGroup: /system.slice/autofs.service
  └─2535 /usr/sbin/automount --pid-file /run/autofs.pid

Jun 29 14:15:16 localhost.localdomain systemd[1]: Starting Automounts filesystems on demand...
Jun 29 14:15:18 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.
Jun 29 14:16:40 localhost.localdomain automount[2535]: key "media" not found in map source(s).
Jun 29 14:18:58 localhost.localdomain automount[2535]: key ":0" not found in map source(s).

Code:

ping cubietruck
PING cubietruck (192.168.123.3) 56(84) bytes of data.
64 bytes from cubietruck (192.168.123.3): icmp_seq=1 ttl=64 time=0.911 ms
64 bytes from cubietruck (192.168.123.3): icmp_seq=2 ttl=64 time=0.257 ms
64 bytes from cubietruck (192.168.123.3): icmp_seq=3 ttl=64 time=0.249 ms
64 bytes from cubietruck (192.168.123.3): icmp_seq=4 ttl=64 time=0.469 ms
64 bytes from cubietruck (192.168.123.3): icmp_seq=5 ttl=64 time=0.251 ms
64 bytes from cubietruck (192.168.123.3): icmp_seq=6 ttl=64 time=0.243 ms
^C
--- cubietruck ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5124ms
rtt min/avg/max/mdev = 0.243/0.396/0.911/0.244 ms

I'm using Mageia 6 but in Mageia 5 I got the same.

Thanks in advance.

pan64 06-30-2017 03:12 AM

you do not need to put : before the name of the server.
/media/NFS -fstype=nfs,rw,nosuid,nodev :cubietruck:/media/hd/FS-01/
would be nice to check the logs, probably you will find a related message

ferrari 06-30-2017 04:02 AM

The first field specified in /etc/autofs.master should look like this

Code:

/media  /etc/autofs/auto.cubie  --timeout=60
and the first field in /etc/autofs/auto.cubie should just be NFS (as opposed to /media/NFS)

Code:

NFS  -fstype=nfs,rw,nosuid,nodev  cubietruck:/media/hd/FS-01/

apimente.br 06-30-2017 07:37 AM

Quote:

Originally Posted by ferrari (Post 5729059)
The first field specified in /etc/autofs.master should look like this

Code:

/media  /etc/autofs/auto.cubie  --timeout=60
and the first field in /etc/autofs/auto.cubie should just be NFS (as opposed to /media/NFS)

Code:

NFS  -fstype=nfs,rw,nosuid,nodev  cubietruck:/media/hd/FS-01/

It works. Thanks a lot.

pan64 - thank you!


All times are GMT -5. The time now is 07:23 AM.