OverlayFS

 

 

OverlayFS

It was introduced in kernel 3.18

Used to merge two filesystems, one read-only and the other writable.

mount -t overlayfs -o [options] overlayfs [mountpoint for merged system]

mount -t overlay overlay -olowerdir=/lower,upperdir=/upper /merged

options:

owerdir=somedir

upperdir=somedir: upperdir is the directory you want to overlay lowerdir with.
                  If duplicate filenames exist in lowerdir and upperdir, upperdir's version takes precedence.

Only the lists of names from directories are merged.  Other content
such as metadata and extended attributes are reported for the upper
directory only.

Changes to the underlying filesystems while part of a mounted overlay
filesystem are not allowed.  If the underlying filesystem is changed,
the behavior of the overlay is undefined, though it will not result in
a crash or deadlock.

Directories:

up          low
directories non-directory up
directories directories   merged

upper filesystemthat files have been removed.

whiteouts

A whiteout is created as a character device with 0/0 device number.
When a whiteout is found in the upper level of a merged directory, any
matching name in the lower level is ignored, and the whiteout itself
is also hidden.

write-access

the file is first copied from the lower filesystem
to the upper filesystem (copy_up).  
Note that creating a hard-link also requires copy_up

Any open files referring to this inode will access the old data and
metadata.  Similarly any file locks obtained before copy_up will not
apply to the copied up file.

If a file with multiple hard links is copied up, then this will
"break" the link.  Changes will not be propagated to other names
referring to the same inode.