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.

  • 1
    huh? not quite sure what you mean. could you provide more information, maybe draw a diagram? – sybreon Sep 9 '11 at 0:37
  • 1
    Does it not work to add the top level directory to /etc/exports? – Matt Sep 9 '11 at 1:26

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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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