/etc/exports not working

Hello all

I’m trying to put up a very simple NFS mount scheme between 2 dietpi-based servers

On the serving machine I installed NFS Server package, and added an appropriate inside the /etc/exports file saying something like
/mnt/hd0 10.10.0.*(rw,async,no_root_squash,fsid=0,crossmnt,no_subtree_check)
restarting the services after then edit

on the client machine I installed the NFS Client package, and I used dietpi-drive_manager to mount the NFS share from the previous machine

as it is known, this generates an appropriate line into /etc/fstab

so far so good: it works

However, from the client machine I do not see the contents of the /mnt/hd0 directory I intended to share from the server machine, but I get the contents of the servers’ dietpi_userdata folder (which is another one).


I went through all the steps twice,
tried to re-create the config files from scratch, nothing.



What am I possibly doing wrong?

Thanks in advance for help

A.

DietPi Drive manager is not mounting the NFS export correctly. At the moment it is not able to mount sub folder

pls can you share following from the client side

showmount -e <server.ip>
cat /etc/fstab

There you go:

dietpi@DietPi:~$ sudo showmount -e 10.10.0.15
Export list for 10.10.0.15:
/mnt/dietpi_userdata *
/mnt/hd0             10.10.0.*



dietpi@DietPi:~$ cat /etc/fstab
# You can use "dietpi-drive_manager" to setup mounts.
# NB: It overwrites and re-creates physical drive mount entries on use.
#----------------------------------------------------------------
# NETWORK
#----------------------------------------------------------------
10.10.0.15:/mnt/hd0 /mnt/bananapi nfs nofail,noauto,x-systemd.automount

#----------------------------------------------------------------
# TMPFS
#----------------------------------------------------------------
tmpfs /tmp tmpfs size=1024M,noatime,lazytime,nodev,nosuid,mode=1777
tmpfs /var/log tmpfs size=50M,noatime,lazytime,nodev,nosuid,mode=1777

#----------------------------------------------------------------
# MISC: ecryptfs, vboxsf (VirtualBox shared folder), gluster, bind mounts
#----------------------------------------------------------------


#----------------------------------------------------------------
# SWAP SPACE
#----------------------------------------------------------------
/var/swap none swap sw

#----------------------------------------------------------------
# PHYSICAL DRIVES
#----------------------------------------------------------------
UUID=8f72188e-28db-4567-8952-1d82a5ed6ac1 / ext4 noatime,lazytime,rw 0 1
UUID=7ea03546-ce3f-4807-a78f-342a436e8ca8 /mnt/hd1 ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount
UUID=8425e7c8-f849-4991-a285-6ba07c3cdc08 /mnt/hdtorrent ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount
UUID=eb35d4b7-65a0-43a1-b929-30805e2781aa /mnt/hd2 ext4 noatime,lazytime,rw,nofail,noauto,x-systemd.automount

by indicating 10.10.0.15:/mnt/hd0 into the client’s /etc/fstab I subsequently get

dietpi@DietPi:~$ ls /mnt/bananapi
ls: impossibile accedere a '/mnt/bananapi': Nessun device corrisponde

thx for your help
A.

what does following show on client side?

df -h
ls -la /mnt
dietpi@DietPi:~$ df -h
File system     Dim. Usati Dispon. Uso% Montato su
udev            424M     0    424M   0% /dev
tmpfs            99M  4,4M     95M   5% /run
/dev/mmcblk0p1   30G  2,2G     28G   8% /
tmpfs           493M  948K    492M   1% /dev/shm
tmpfs           5,0M     0    5,0M   0% /run/lock
tmpfs           1,0G  8,0K    1,0G   1% /tmp
tmpfs            50M   32K     50M   1% /var/log
dietpi@DietPi:~$ ls -la /mnt
ls: impossibile accedere a '/mnt/bananapi': Nessun device corrisponde
totale 32
drwxr-xr-x  9 root   root   4096 23 gen 23.10 .
drwxr-xr-x 18 root   root   4096 16 dic 02.55 ..
d?????????  ? ?      ?         ?            ? bananapi
drwxrwxr-x  7 dietpi dietpi 4096 23 gen 22.49 dietpi_userdata
drwxrwxr-x  2 dietpi dietpi 4096  7 ott 01.13 ftp_client
drwxrwsrwx  5   1001   1001 4096 22 gen 12.33 hd1
drwxrwsrwx  5   1001   1001 4096 23 gen 15.22 hd2
drwxr-xr-x  5 root   root   4096 18 feb  2020 hdtorrent
drwxrwxr-x  2 dietpi dietpi 4096  7 ott 01.13 samba

The NFS doesn’t seems to be mounted. Try to reboot your system. Check following afterwards

df -h
ls -la /mnt
cd /mnt/bananapi
df -h
dietpi@DietPi:~$ df -h
File system     Dim. Usati Dispon. Uso% Montato su
udev            424M     0    424M   0% /dev
tmpfs            99M  3,1M     96M   4% /run
/dev/mmcblk0p1   30G  2,2G     28G   8% /
tmpfs           493M  948K    492M   1% /dev/shm
tmpfs           5,0M     0    5,0M   0% /run/lock
tmpfs           1,0G     0    1,0G   0% /tmp
tmpfs            50M   32K     50M   1% /var/log
dietpi@DietPi:~$ ls -la /mnt
ls: impossibile accedere a '/mnt/bananapi': Nessun device corrisponde
totale 32
drwxr-xr-x  9 root   root   4096 23 gen 23.10 .
drwxr-xr-x 18 root   root   4096 16 dic 02.55 ..
d?????????  ? ?      ?         ?            ? bananapi
drwxrwxr-x  7 dietpi   1000 4096 23 gen 22.49 dietpi_userdata
drwxrwxr-x  2 dietpi   1000 4096  7 ott 01.13 ftp_client
drwxrwsrwx  5   1001 dietpi 4096 22 gen 12.33 hd1
drwxrwsrwx  5   1001 dietpi 4096 23 gen 15.22 hd2
drwxr-xr-x  5 root   root   4096 18 feb  2020 hdtorrent
drwxrwxr-x  2 dietpi   1000 4096  7 ott 01.13 samba
dietpi@DietPi:~$ df -h
File system     Dim. Usati Dispon. Uso% Montato su
udev            424M     0    424M   0% /dev
tmpfs            99M  3,1M     96M   4% /run
/dev/mmcblk0p1   30G  2,2G     28G   8% /
tmpfs           493M  948K    492M   1% /dev/shm
tmpfs           5,0M     0    5,0M   0% /run/lock
tmpfs           1,0G     0    1,0G   0% /tmp
tmpfs            50M   32K     50M   1% /var/log
/dev/sdd1       916G  701G    216G  77% /mnt/hd2
/dev/sdb1       229G  9,9G    219G   5% /mnt/hdtorrent
/dev/sdc1       916G  612G    304G  67% /mnt/hd1
dietpi@DietPi:~$ cd /mnt/bananapi
-bash: cd: /mnt/bananapi: Nessun device corrisponde
dietpi@DietPi:~$

same as before

The directory bananapi seems to be broken. Try to remove it

rm -Rf /mnt/bananapi
ls -la /mnt

No joy.

Had to umount the nfs share before removing the directory, as it told me it was “busy”.
They I rebooted.
Same situation as before now:

dietpi@DietPi:~$ ls -la /mnt
ls: impossibile accedere a '/mnt/bananapi': Nessun device corrisponde
totale 32
drwxr-xr-x  9 root   root   4096 24 gen 19.29 .
drwxr-xr-x 18 root   root   4096 16 dic 02.55 ..
d?????????  ? ?      ?         ?            ? bananapi
drwxrwxr-x  7 dietpi   1000 4096 23 gen 22.49 dietpi_userdata
drwxrwxr-x  2 dietpi   1000 4096  7 ott 01.13 ftp_client
drwxrwsrwx  5   1001 dietpi 4096 22 gen 12.33 hd1
drwxrwsrwx  5   1001 dietpi 4096 23 gen 15.22 hd2
drwxr-xr-x  5 root   root   4096 18 feb  2020 hdtorrent
drwxrwxr-x  2 dietpi   1000 4096  7 ott 01.13 samba

Ok it looks like I solved it by comparing the fstab strings which which the server (in its turn) mounted another NFS server as a client from a third machine.

At the end of the relevant fstab line on the “working” case there are two 0’s.
Like:

10.10.0.234:/MUSICA /mnt/omv_musica nfs _netdev,timeo=14,intr,nofail 0 0

By putting the same “0 0” onto my reluctant client’s fstab, the folder is now mounted as intended:

10.10.0.15:/mnt/hd0 /mnt/bananapi nfs nofail,noauto,x-systemd.automount 0 0

This is actually quite odd as if I dont go wrong missing 5th and 6th fields on the ftsab line should be taken as 0 and 0

Still, it works…

A.

Yes indeed those two fields are not required, we leave them out in all cases where the fsck flag (6th) is not wanted, hence all but root and boot mounts. _netdev and intr are set by default, hence have no effect, timeo=14 doubles the request timeout from 0.7s to 1.4s, reasonable in case of slow networks when facing response error messages. If the issue re-appears, you may try to add the timeo=14 option.

Is there a chance that anything is trying to access the /mnt/bananapi mount point early during boot, before network is up, or do you do that manually only? In case it may be worth to try removing noauto,x-systemd.automount options, so that the mount is done automatically at boot (not on mount point access), but after network is up (this option has become more reliable with one of the recent DietPi versions).