Mount an nfs share under a different name

In Ubuntu I may configure an NFS share that way:

sudo vi /etc/fstab
/dev/disk/by-uuid/0ab4599f-84da-4492-a1a8 /mnt/main
/mnt/main/video /export/main none bind 0 0

sudo vi /etc/exports
/export/main 192.168.2.0/24(ro,nohide,insecure,no_subtree_check,sync)

How to do it in OpenWrt? I mean, I would like the OpenWrt router's directory /mnt/main/video be exported as /export/main?

My two cents:

  • Actually, this is not about NFS; you are creating a bind mount and then exporting it via NFS, but the magic happens on the bind mount, not on NFS.
  • As far as I know, OpenWrt cannot do bind mounts; at least, the documentation (Fstab Configuration) does not mention them.

As an alternative, I would try to use a symlink:
mkdir /export
ln -s /mnt/main/video /export/main

OK, thanks. So, it doesn't work, the way, I expected.

When I do showmount -e openwrt.lan it shows me /mnt/main/video instead of /export/main.

But anyway thank you. I simply realized, it is simpler (and faster) to update configuration in the devices which use the shares.

1 Like