Skip to content

Commit bb7055a

Browse files
alexlarssonamir73il
authored andcommitted
ovl: Add documentation on nesting of overlayfs mounts
Signed-off-by: Alexander Larsson <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Signed-off-by: Amir Goldstein <[email protected]>
1 parent bc8df7a commit bb7055a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Documentation/filesystems/overlayfs.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,29 @@ directory tree on the same or different underlying filesystem, and even
504504
to a different machine. With the "inodes index" feature, trying to mount
505505
the copied layers will fail the verification of the lower root file handle.
506506

507+
Nesting overlayfs mounts
508+
------------------------
509+
510+
It is possible to use a lower directory that is stored on an overlayfs
511+
mount. For regular files this does not need any special care. However, files
512+
that have overlayfs attributes, such as whiteouts or "overlay.*" xattrs will be
513+
interpreted by the underlying overlayfs mount and stripped out. In order to
514+
allow the second overlayfs mount to see the attributes they must be escaped.
515+
516+
Overlayfs specific xattrs are escaped by using a special prefix of
517+
"overlay.overlay.". So, a file with a "trusted.overlay.overlay.metacopy" xattr
518+
in the lower dir will be exposed as a regular file with a
519+
"trusted.overlay.metacopy" xattr in the overlayfs mount. This can be nested by
520+
repeating the prefix multiple time, as each instance only removes one prefix.
521+
522+
A lower dir with a regular whiteout will always be handled by the overlayfs
523+
mount, so to support storing an effective whiteout file in an overlayfs mount an
524+
alternative form of whiteout is supported. This form is a regular, zero-size
525+
file with the "overlay.whiteout" xattr set, inside a directory with the
526+
"overlay.whiteouts" xattr set. Such whiteouts are never created by overlayfs,
527+
but can be used by userspace tools (like containers) that generate lower layers.
528+
These alternative whiteouts can be escaped using the standard xattr escape
529+
mechanism in order to properly nest to any depth.
507530

508531
Non-standard behavior
509532
---------------------

0 commit comments

Comments
 (0)