How is readdir handled in an OverlayFS file?

How is readdir handled in an OverlayFS file?

Readdir on directories that are not merged is simply handled by the underlying directory (upper or lower). When renaming a directory that is on the lower layer or merged (i.e. the directory was not created on the upper layer to start with) overlayfs can handle it in two different ways:

How to use multiple lower layers in OverlayFS-Stack Overflow?

You can use one existing overlay over another one mounting it many times. Just set the lowerdir of one overlay as the mount point of an existing overlay (and so on…). For example, a three level overlay: Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.

How is a folder hidden in an overlay filesystem?

If a given name appears in both upper and lower filesystems and refers to a non-directory in either, then the lower object is hidden – the name refers only to the upper object. Where both upper and lower objects are directories, a merged directory is formed.

How to enable Overlay Filesystem in Linux kernel?

The “xino” feature can be enabled with the “-o xino=on” overlay mount option. If all underlying filesystems support NFS file handles, the value of st_ino for overlay filesystem objects is not only unique, but also persistent over the lifetime of the filesystem.

Which is the result of an overlay filesystem?

An overlay-filesystem tries to present a filesystem which is the result over overlaying one filesystem on top of the other. The overlay filesystem approach is ‘hybrid’, because the objects that appear in the filesystem do not always appear to belong to that filesystem.

Who is the author of Overlay Filesystem in Linux?

Written by: Neil Brown Please see MAINTAINERS file for where to send questions. This document describes a prototype for a new approach to providing overlay-filesystem functionality in Linux (sometimes referred to as union-filesystems).

How to merge two directories in overlay filesystem?

At mount time, the two directories given as mount options “lowerdir” and “upperdir” are combined into a merged directory: mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,workdir=/work /merged The “workdir” needs to be an empty directory on the same filesystem as upperdir.