Cannot mount nfs shares with autofs

I followed this tutorial and now I can see all my samba shares inside /mnt, but what if I want to access some nfs shares too? If I add both lines in auto.master, none of them works fine.

Should work. Please post your auto.master, auto.smb.shares, auto.nfs.shares.

1 Like

Ok:

auto.smb.shares:

/mnt/disco0 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Disco\ 0-L
/mnt/disco2 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Disco\ 2-N
/mnt/disco5 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Disco\ 5-Q
/mnt/disco7 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Disco\ 7-S
/mnt/disco8k -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Disco\ 8-4k
/mnt/disco9 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Disco\ 9-WD
/mnt/series -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/Series
/mnt/peliculas7 -fstype=cifs,rw,credentials=/home/osmc/.smbcredentials,iocharset=utf8,uid=osmc,gid=osmc ://192.168.0.110/video/Peliculas7

auto.nfs.shares:

/mnt/disco0nfs 192.168.0.110:i-data/2dc65cad/nfs/Disco0NFS

auto.master:

# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
#/misc  /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#       "nosuid" and "nodev" options unless the "suid" and "dev"
#       options are explicitly given.
#
#/net   -hosts
#
# Include /etc/auto.master.d/*.autofs
# To add an extra map using this mechanism you will need to add
# two configuration items - one /etc/auto.master.d/extra.autofs file
# (using the same line format as the auto.master file)
# and a separate mount map (e.g. /etc/auto.extra or an auto.extra NIS map)
# that is referred to by the extra.autofs file.
#
+dir:/etc/auto.master.d
#
# If you have fedfs set up and the related binaries, either
# built as part of autofs or installed from another package,
# uncomment this line to use the fedfs program map to access
# your fedfs mounts.
#/nfs4  /usr/sbin/fedfs-map-nfs4 nobind
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
 /- /etc/auto.smb.shares --timeout 15 browse

Tried to add
ā€˜ā€™ā€™

 /- /etc/auto.nfs.shares --timeout 15 browse

And found that none of them (nfs or smb) appears.

You need the root slash:

/mnt/disco0nfs 192.168.0.110:/i-data/2dc65cad/nfs/Disco0NFS

2 Likes

Edited with no result; now all mounted folders are empty (and ā€œdisco0nfsā€ doesnā€™t even appear)

What sort of device is 192.168.0.110? Iā€™m puzzled why you would want to share some data with samba and some others with nfs.

Itā€™s an old nas (zyxel nsa325v2), which shares only in samba v1 or nfs (but this way I am struggling to make it share the usb units); thatā€™s why Iā€™m trying to make nfs work, but until I make it I want to make samba work.

If I understand it fine, the best way to share would be nfs.

run showmount -e 192.168.0.110 that should tell you which shares the NAS exports for which IP.

Only NFS shares appears, but those that are working are the smb ones:

Export list for 192.168.0.110:
/i-data/cba0864c/nfs/Disco7NFS           *
/i-data/2dc65cad/nfs/Disco0NFS           *
/e-data/c951f3cc780eb9ae37e5dd1e6b11013c (everyone)
/e-data/4b057828951167c27e50544d8404a891 (everyone)
/e-data/a35de5893a858e7a94bbbee375814f29 (everyone)

Could be that the indirect mounts donā€™t work with two sources.
Try /nfs /etc/auto.nfs.shares --timeout 15 browse

Same result; no nfs share is shared, smb shares are not accessible anymore

Hi,

sudo systemctl stop autofs
sudo automount -f -v -d

What does the 2nd command report?

Thanks Tom.

Starting automounter version 5.1.7, master map /etc/auto.master
using kernel protocol version 5.02
lookup_nss_read_master: reading master file /etc/auto.master
do_init: parse(sun): init gathered global options: (null)
lookup_read_master: lookup(file): read entry +dir:/etc/auto.master.d
lookup_nss_read_master: reading master dir /etc/auto.master.d
lookup_read_master: lookup(dir): scandir: /etc/auto.master.d
lookup_read_master: lookup(file): read entry +auto.master
lookup_nss_read_master: reading master files auto.master
do_init: parse(sun): init gathered global options: (null)
lookup_read_master: lookup(file): read entry /-
master_do_mount: mounting /-
automount_path_to_fifo: fifo name /var/run/autofs.fifo--
lookup_nss_read_map: reading map file /etc/auto.smb.shares
do_init: parse(sun): init gathered global options: (null)
mounted direct on /mnt/disco7 with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/disco7
mounted direct on /mnt/disco8k with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/disco8k
mounted direct on /mnt/disco0 with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/disco0
mounted direct on /mnt/disco5 with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/disco5
mounted direct on /mnt/peliculas7 with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/peliculas7
mounted direct on /mnt/series with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/series
mounted direct on /mnt/disco9 with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/disco9
mounted direct on /mnt/disco2 with timeout 15, freq 4 seconds
do_mount_autofs_direct: mounted trigger /mnt/disco2
st_ready: st_ready(): state = 0 path /-
statemachine:1622: got unexpected signal 28!

Hi,

Does it work when just mounting NFS on its own?

Regards Tom.

No, it doesnā€™t. Frankly, I think Iā€™m done with it; Iā€™m barely sure that the problem is that the NAS doesnā€™t mount nfs correctly, so we are making aproximation with no sucess guarantee. I will keep using smb as long as I canā€™t access a new nas and then will switch to a better one.

Thanks a lot for helping me, you rule!!

Hi,

Manually mounting with verbose, may give us more insight as to why its not working. For testing please try and provide the output of:

sudo mkdir /mnt/disco0nfs
sudo mount -v -t nfs 192.168.0.110:/i-data/2dc65cad/nfs/Disco0NFS  /mnt/disco0nfs

Thanks Tom.

Thatā€™s the result:

mount.nfs: timeout set for Sun May 22 17:51:37 2022
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.0.110,clientaddr=192.168.0.108'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.1,addr=192.168.0.110,clientaddr=192.168.0.108'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.0,addr=192.168.0.110,clientaddr=192.168.0.108'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=192.168.0.110'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.0.110 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.0.110 prog 100005 vers 3 prot UDP port 5132

Hi,

It looks like it may have mounted using nfs version3, are you able to access the share?

Thanks Tom.

Tried it with windows and all I get is an empty folder; no linux available for now, so I was testing with vero4k, so this is the only way I can test if it works.

Hi,

I meant are you able to access the share on the vero4k?

on the commandline, you can issue mount on itā€™s own and it will listed the currently mounted partitions and shares. If all looks look good you can issue:

cd /mnt/disco0nfs
ls

Do you see the files and directories from the NAS?

Regards Tom.