I am running into an issue with NFS that I am not sure how to solve. I have spent a bit of time trying to find an answer but was not successful. I am ultimately trying to achieve the below setup without having to mount each sub-directory individually as these may change overtime dynamically and that route will not scale.

NFS Server1 exports /srv/files/ and within that directory are these subdirectories which have the actual files needed on the client


NFS Server2 exports its own /srv/files and within that directory is a similar structure though the subfolders will have a name unique in respect to NFS Server1 folders


NFS Client can mount both NFS server shares as read only but within the same directory:


Is this possible to do? Is NFS the right route? Again I will not need to write data to the NFS Servers, simply read.

  • Nope, can't be done. But I suspect you have an X-Y problem going on here. – womble Jan 15 '20 at 3:27
  • Valid point. Ultimately these files will be generated on remote machines and available to a web server that will allow downloading of the files. I don't want the files traversing the network prior to the download however since not all files will be download and each one is over 20MB, hence the use of NFS instead of some type of file transfer and this also needs to scale well. There may be a better tool for this. – timmytimmers Jan 15 '20 at 19:40

This is possible to do directly with NFS, but you can use unionfs or overlayfs to achieve that. As overlayfs is part of the standard kernel I would suggest to try it first, something like:

$ mount srv1:/srv/files /srv1
$ mount srv2:/srv/files /srv2
$ mount -t overlay overlay -olowerdir=/srv1:/srv2 /srv/nfs
  • This looks to be a workable solution. Thanks for the command example. I will need to test this further. – timmytimmers Jan 15 '20 at 19:42
  • After testing overlayfs works perfect for what I am looking for. Important to note that this example mounts the overlay as read only which fits my use case. This could also be mounted for writing. Thanks for the help – timmytimmers Jan 17 '20 at 5:13

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.