Nfs – Read only NFS mount with local writes allowed

mountnfs

I would want to share a directory via NFS only read-only (data should not be corrupted).

However I would want the client to be able to use the mounted folder as if it was read write, as transparently as possible.

Basically I would want updates to go only one way, from server to client and not the other way around.

I don't really mind if my local updates are not 100% reliable (if they can be overriden by the reference server).

Is there a way ? With NFS options directly ? With some kind of mount trick ? I'm using Ubuntu 12.04 on both sides.

Thanks !

Best Answer

The overlay fs provides a possibility to mount one filesystem on top of other one. You can use your nfs mount as lower fs and some local directory as upper fs. The local change will not be sent to the NFS server. More info: https://git.kernel.org/cgit/linux/kernel/git/mszeredi/vfs.git/tree/Documentation/filesystems/overlayfs.txt?h=overlayfs.current