Merge two NFS shares with OverlayFS

nfsoverlayfs

I have two directories (a and b), which are NFS shares with files foo.txt and bar.txt:

I want merge this two directories to directory merge (does not have to be writable)

this is possible by command:

sudo mount -t overlay -olowerdir=a:b overlay merge

At first sight everything is ok:

.
├── a
│   └── foo.txt
├── b
│   └── bar.txt
└── merge
    ├── bar.txt
    └── foo.txt

But i can not read content of files:

$ cat merge/foo.txt
cat: merge/foo.txt: No such device or address

This occurs only on NFS share, on plain FS no problem.


According to documentation https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt:

An overlay filesystem combines two filesystems – an 'upper' filesystem
and a 'lower' filesystem.

A read-only overlay of two read-only filesystems may use any
filesystem type.

So I guess NFS is not a problem.

Best Answer

What kernel are you using? it seems that a bug was introduced in kernel 4.2:

https://github.com/coreos/rkt/issues/1537

Related Question