OverlayFS
OverlayFS is a union mount filesystem built directly into the Linux kernel. Like UnionFS, it allows multiple directories—known as layers—to be combined into a single unified view. OverlayFS designates:
- a lower directory (usually read-only),
- an upper directory (read-write), and
- a merged directory (what the user sees).
When a file exists in both the lower and upper directories, the version from the upper directory takes precedence. Any changes made are written only to the upper directory.
This efficient merging mechanism makes OverlayFS well-suited for scenarios that require lightweight, copy-on-write layering.
History
OverlayFS was introduced into the Linux kernel in version 3.18 (2014) after several years of experimentation with alternative union filesystem implementations like UnionFS and AUFS. The Linux community adopted OverlayFS because of its simplicity, stability, and performance advantages compared to earlier approaches.
Today, OverlayFS is a standard part of modern Linux distributions and is widely used in production environments, from enterprise servers to container runtimes.
Examples of Usage
-
Live Environments and Recovery Media Bootable Linux distributions often use OverlayFS so that the base system (on CD, DVD, or ISO) remains read-only, while a temporary writable overlay provides a functional live environment.
-
Sandboxing Developers and testers can overlay a clean, read-only base system with a writable layer, easily discarding changes when no longer needed.
-
Container Runtime Storage OverlayFS is a default backend for container engines like Docker and Podman. Each image layer is read-only, while a writable overlay records the container’s live state.
Relation to Containerization
OverlayFS is a cornerstone of modern container technology. Containers depend on layered filesystems to avoid duplicating data across images:
- Base image layers: operating system and dependencies
- Intermediate layers: application libraries and runtimes
- Top writable layer: the container’s runtime state
Because OverlayFS runs in the kernel, it provides significantly better performance and scalability than user-space union solutions. This efficiency is one reason why OverlayFS has become the de facto standard for container storage drivers on Linux.
Conclusion
OverlayFS offers a fast, simple, and reliable way to unify multiple directories in Linux. By introducing native kernel support for union filesystems, it overcame the limitations of earlier solutions like UnionFS and AUFS.
Its lightweight copy-on-write semantics and kernel-level performance made it a natural fit for container platforms, ensuring that OverlayFS is not just a filesystem tool but a fundamental building block of cloud-native infrastructure.