Share virtual folder through NFS

I’ve shared a drive from computer B to computer A like this:

$c: client, $s: server
$s sudo chmod 777 /mnt/hdd1
$s sudo cat /etc/fstab
UUID=301e3d8d-6c0a-4f7c-864b-4185a70efbb0 /mnt/hdd1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
$s sudo vi /etc/exports
/mnt/hdd1  192.168.1.45/24(rw,sync,no_subtree_check)
$s sudo exportfs -arv
$s sudo systemctl enable --now nfs-server.service

$c sudo systemctl enable --now nfs-client.target
$c showmount -e 192.168.1.45
Export list for 192.168.1.45:
/mnt/hdd1 192.168.1.45/24
$c sudo cat /etc/fstab
192.168.1.45:/mnt/hdd1   /nfs/hdd1  nfs auto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
$c sudo mkdir -p /nfs/hdd1
$c sudo chmod 755 /nfs/hdd1
$c sudo systemctl daemon-reload
$c sudo mount -a
$c ls /nfs/hdd1

Then I’ve made a virtual folder in computer A with mergerfs:

/mnt/hdd*:/srv/nfs/hdd1  /mnt/storage      fuse.mergerfs  allow_other,use_ino,cache.files=off,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,x-gvfs-show   0       0

Now I want to share back the merged folder with computer B

❯ sudo chmod 777 /mnt/storage
❯ sudo vi /etc/exports
/mnt/storage  192.168.1.122/24(rw,sync,no_subtree_check)

But I get this:

❯ sudo exportfs -arv
exporting 192.168.1.122/24:/mnt/storage
exportfs: /mnt/storage requires fsid= for NFS export
exporting 192.168.1.122/24:/mnt/V

What do I need to do?

:vampire:

Read the docs

Before you continue with a complicated setup like mergerfs - do yourself ( and your fellow forum members ) a favor

  1. learn you filesystem basics - ACL
  2. learn how to mount reliably and in a aconsistent manner
  3. learn how permissions affects mounting and the content of the mount point
  4. learn how permissions works when sharing nested content whether local or remote

When you understand above - perhaps you are ready for mergerfs

exportfs: requires fsid= for NFS export

As not all filesystems are stored on devices and not all filesystems have UUIDs (e.g. FUSE), it is sometimes necessary to explicitly tell NFS how to identify a filesystem. This is done with the fsid option:

/etc/exports

/srv/nfs client(rw,sync,crossmnt,fsid=0)
/srv/nfs/music client(rw,sync,fsid=10)

That is documented in the default exports file - which is why I say - Read The Fine Manpage

 $ cat /etc/exports
# /etc/exports - exports(5) - directories exported to NFS clients
#
# Example for NFSv3:
#  /srv/home        hostname1(rw,sync) hostname2(ro,sync)
# Example for NFSv4:
#  /srv/nfs4        hostname1(rw,sync,fsid=0)
#  /srv/nfs4/home   hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
#  /srv/nfs4        *(rw,sync,sec=krb5i,fsid=0)
#  /srv/nfs4/home   *(rw,sync,sec=krb5i,nohide)
#
# Use `exportfs -arv` to reload.

It worked for a while but then it stopped working and now I can’t mount it again:

s: server, c: client
s ❯ sudo cat /etc/exports
/mnt/storage  192.168.1.122/24(rw,sync,no_subtree_check,fsid=0)
c ❯ sudo cat /etc/fstab
192.168.1.122:/mnt/storage   /mnt/storage  nfs nosuid,nodev,nofail,x-gvfs-show,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=1min,bg,intr,soft,timeo=5,retrans=5,actimeo=10,retry=5 0 0
c ❯ sudo mount 192.168.1.122:/mnt/storage /mnt/storage
mount.nfs: mount system call failed

The mergerfs folder unmounted and now I can’t mount it either:

s ❯ sudo mount -a
fuse: failed to access mountpoint /mnt/storage: Input/output error

That’s the first time this happens and I had been using it for a while. I can access all drives individually so I don’t know what is the issue.

❯ sudo cat /etc/fstab
/mnt/T:/mnt/V:/mnt/W:/mnt/X:/mnt/Y:/mnt/Z:/srv/nfs/lenovo/hdd1  /mnt/storage      fuse.mergerfs  allow_other,use_ino,cache.files=off,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,x-gvfs-show   0       0

After restarting the part of the system dealing with the virtual drive is hanged.

If I comment the line in /etc/exports and restart it works fine.

I think this has happened me before. I’ll have to try with the crossmnt option on the export.

I give up. The only way I’ve found to fix the hang problem is to remove the nfs share from /etc/fstab. After that it just works perfect. I’ll just use tigervnc which won’t give me so much trouble.

I’ve been using SSHFS for a month or so without any problems. I can’t believe the amount of time I wasted with NFS. It’s buggy and nobody should be recommending it. SSHFS isn’t even maintained and it still works better than that buggy mess.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.