0

I have a raspberry pi. I have shared the /home/pi/ folder via NFS like this:

contents of /etc/exports 

/home/pi        *(rw,all_squash,insecure,async,no_subtree_check,anonuid=1000,anongid=1000)

From another machine, running Debian/KDE, I can correctly launch Dolphin and type nfs://192.168.178.35/home/pi/ which opens up the /home/pi folder and lets me create and edit files.

Then I connect an external HDD to the raspberry and I mount it like this:

contents of /etc/fstab
/dev/sda1       /home/pi/WDD    ext4    user,relatime,nofail,errors=remount-ro,nodev,nosuid     0       0

However, when I try to open the WDD folder from the remote Debian/KDE computer, the WDD is not even recognized as a folder, and I can't open it. The WDD folder belongs to pi:pi, and I can use it fine from within the raspberry. Thanks.

1 Answer 1

1

Under normal circumstances accessing a remotely mounted file system on an NFS share isn't possible. If you'd like to lift the restriction, export the NFS share with the option crossmnt set in the remote exports file for your NFS share, then reexport the share and remount locally.

man exports contains the following section:

  crossmnt
          This option is similar to nohide but it makes it possible for clients to access all filesystems mounted on a filesystem marked with  crossmnt.
          Thus when a child filesystem "B" is mounted on a parent "A", setting crossmnt on "A" has a similar effect to setting "nohide" on B.

          With nohide the child filesystem needs to be explicitly exported.  With crossmnt it need not.  If a child of a crossmnt file is not explicitly
          exported, then it will be implicitly exported with the same export options as the parent, except for fsid=.  This makes it impossible  to  not
          export  a  child  of a crossmnt filesystem.  If some but not all subordinate filesystems of a parent are to be exported, then they must be ex‐
          plicitly exported and the parent should not have crossmnt set.

          The nocrossmnt option can explictly disable crossmnt if it was previously set.  This is rarely useful.

EDIT:

Your exports entry for /home/pi should look like this:

/home/pi        *(rw,all_squash,insecure,async,no_subtree_check,anonuid=1000,anongid=1000,crossmnt)

Then do an exportfs -r on your Raspberry Pi and do a mount <mount-point> -o remount locally, and you are good to go.

2
  • Thanks but I already tried to add 'crossmnt' to the '/home/pi' share. If I do what I just said and then add a second /home/pi/WDD share, I can access the WDD but I lose access to /home/pi.
    – user11230
    Sep 30, 2022 at 7:47
  • 1
    When adding crossmnt to your exported /home/pi, you don't have to explicitly export anything that you have mounted anywhere on the exported share, because the NFS server is implicitly exporting said mounts as well. Your local end then retains the references, and you don't have to explicitly add /home/pi/WDD to your exports. I have verified this, and it works as described.
    – Robidu
    Sep 30, 2022 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.