4

I have an NFS server with a directory which contains a dozen other local filesystems. I'd like to mount the top-level directory on the server, and have the Linux client automatically mount the right filesystems inside that directory, so that the client sees the same directory structure that exists on the server.

I believe what I was asking about was a "recursive mount" type of thing where multiple filesystems could be mounted in a nested fashion on a client. Perhaps this is only an NFSv4 feature. The "nohide" option seems to trick the client into thinking all filesystems are a single mount-point, which is not what I was looking for, but perhaps it's good enough.

Chris Quenelle
  • 183
  • 2
  • 7

2 Answers2

3

You may want to look into the nohide NFS export option to recursively mount filesystem hierarchies. This is assuming the NFS exports are from a Linux system (versus a filer or NAS) and that you're interested in mounting its mounts to your client.

Also see: http://www.digspace.org/linux/7-linux-nfs-nohide

ewwhite
  • 194,921
  • 91
  • 434
  • 799
2

Additionally to using the nohide option in the /etc/exports file on the NFS server as has been suggested in the previous answer is using the package autofson the clients which might be interesting to those not knowing that package yet.

Doing this is simple:

  1. Install the package autofs on each client using a package manager
  2. Afterwards edit the client configuration file /etc/auto.master and remove the comment sign (#) from the line containing /net/;
  3. Save the configuration file and
  4. Restart the autofs service on the client.

    On older Linux distributions this is done using:

    # /etc/init.d/autofs restart
    

    and or more recent distributions this is done using:

    # service autofs restart
    
  5. After that you could change directory (cd /net/NFS_SERVER_HOSTNAME/) and should see all your sub directories (local filesystems) as long as they are listed in the /etc/exports file on the NFS server. So the entries in /etc/exports control which of the local filesystems should be available for mounting on the clients.

pefu
  • 629
  • 6
  • 20