问题原文
原帖链接 · timmytimmers · CC BY-SA 4.0
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
/srv/files/0001/
/srv/files/0002/
/srv/files/0003/
/srv/files/0004/
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
/srv/files/0005/
/srv/files/0006/
/srv/files/0007/
/srv/files/0008/
NFS Client can mount both NFS server shares as read only but within the same directory:
/srv/nfs/0001
/srv/nfs/0002
/srv/nfs/0003
/srv/nfs/0004
/srv/nfs/0005
/srv/nfs/0006
/srv/nfs/0007
/srv/nfs/0008
Is this possible to do? Is NFS the right route? Again I will not need to write data to the NFS Servers, simply read.
已采纳解答
原帖链接 · kofemann · CC BY-SA 4.0
This is not 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 trying it first, something like:
$ mount srv1:/srv/files /srv1
$ mount srv2:/srv/files /srv2
$ mount -t overlay overlay -olowerdir=/srv1:/srv2 /srv/nfs
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
