[SOLVED] Weird NFS exports problem

Hello,

I have been using my nixos box for my NAS running on NFS.
It was single disk so far, with a folder bind mounted to /srv/nfs.

Now I have added a second disk to my server and ran into some trouble.

From what I understand /etc/exports is recursive – it worked for the single disk.
What I tried to do is mount the disks under /srv/nfs/1 and 2.

root@server# ls  -l /srv/nfs/
total 16
drwxrwxrwx 1 root shares 496 04-12 22:48 1
drwxrwxrwx 1 root shares 132 03-24 23:25 2
root@server# ls -R /srv/nfs | head -n 100 | wc -l
100

However on the host it looks like this:

user@client$ ls -R NFS
NFS:
1  2

NFS/1:

NFS/1:

This is the exports for it: /srv/nfs <IP>(rw,anonuid=1000,anongid=100,no_subtree_check,root_squash)
For this to work now I need to point to /srv/nfs/1 and 2 separately, which makes my life harder.

Does anyone know what causes this problem?
Maybe there is a better way of accessing two disks through NFS?

have you tried adding crossmnt to your export options? i.e. /srv/nfs <IP>(rw,anonuid=1000,anongid=100,no_subtree_check,root_squash,crossmnt)

1 Like

you might also try fsid=root, though i think that should already be implied.

crossmnt worked great.

What would the fsid=root change? Is it strictly for old clients?

i’ve seen fsid=root used when you have, rather than nested linux mounts, nested exports. NFS4 clients will transparently mount sub-exports, so i’ve seen some people solve the issue you’re facing by making /srv/nfs/1 and /srv/nfs/2 proper exports, and then make /srv/nfs also an export with fsid=0 so that when a client asks “give me the default export”, it knows to mount /srv/nfs (after which 1 and 2 are mounted on-demand).

i’m less experienced with that type of setup though, so don’t take me word as gospel :slight_smile:

1 Like

I see.

I want to mount the /srv/nfs/ once so that the nix that I write is simpler.
With three exports it would only complicate the matter so I will not even try that but thanks for making me understand how ot works.