# OverlayFS

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/OverlayFS
> Markdown URL: https://mediated.wiki/source/OverlayFS.md
> Source: https://en.wikipedia.org/wiki/OverlayFS
> Source revision: 1281573691
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{short description|Linux filesystem}}
{{Infobox filesystem
| name                    = OverlayFS
| full_name               = Overlay File System
| developer               = [Miklos Szeredi](/source/Miklos_Szeredi), [open-source community](/source/open-source_community)
| introduction_os         = 
| introduction_date       =
| partition_id            = 
| directory_struct        = 
| file_struct             = 
| bad_blocks_struct       = 
| max_filename_size       = 
| max_files_no            = 
| max_volume_size         = 
| max_file_size           = 
| filename_character_set  = 
| dates_recorded          = 
| date_range              = 
| date_resolution         = 
| forks_streams           = 
| attributes              = 
| file_system_permissions = [POSIX](/source/POSIX)
| compression             = 
| encryption              = 
| OS                      = [Linux](/source/Linux), [FreeBSD](/source/FreeBSD) and [NetBSD](/source/NetBSD){{cn|date=August 2024|reason=see [Talk:OverlayFS#BSD?](/source/Talk%3AOverlayFS)}}
}}

'''OverlayFS''' is a [union mount](/source/union_mount) filesystem implementation for Linux. It combines multiple different underlying mount points into one, resulting in a single directory structure that contains underlying files and sub-directories from all sources. Common applications overlay a read/write partition over a read-only partition, such as with [LiveCDs](/source/Live_CD) and [IoT devices](/source/IoT_device) with limited flash memory write cycles.

==History==

The need and specification of a kernel mode Linux union mount filesystem was identified in late 2009.<ref>{{Cite web
| title = Unioning file systems: Architecture, features, and design choices
| last = Aurora
| first = Valerie
| website = LWN.net
| date = March 18, 2009
| access-date = 2018-01-17
| url = https://lwn.net/Articles/324291/
}}</ref> The initial RFC patchset of OverlayFS was submitted by Miklos Szeredi in 2010.<ref>{{Cite web
| title = Another union filesystem approach
| last = Edge
| first = Jake
| website = LWN.net
| date = September 1, 2010
| access-date = 2018-01-17
| url = https://lwn.net/Articles/403012/
}}</ref> By 2011, [OpenWrt](/source/OpenWrt) had already adopted it for their use.<ref>{{Cite web
| title = Debating overlayfs
| last = Corbet
| first = Jonathan
| website = LWN.net
| date = June 15, 2011
| access-date = 2018-01-17
| url = https://lwn.net/Articles/447650/
}}</ref>

It was merged into the [Linux kernel mainline](/source/Linux_kernel_mainline) in 2014, in kernel version 3.18.<ref>{{cite web | url= https://github.com/torvalds/linux/commit/e9be9d5e76e34872f0c37d72e25bc27fe9e2c54c | title= OverlayFS commit to Linux| website= [GitHub](/source/GitHub)}}</ref><ref>{{cite web | url= https://www.phoronix.com/scan.php?page=news_item&px=MTc5OTc | title= OverlayFS Proposed For The Linux 3.18 Kernel}}</ref> It was improved in version 4.0, bringing improvements necessary for e.g. the {{mono|overlay2}} storage driver in [Docker](/source/Docker_(software)).<ref>{{Cite news|url=https://docs.docker.com/engine/userguide/storagedriver/selectadriver/|title=Select a storage driver - Docker|date=2016-12-06|work=archive.is|access-date=2017-06-05|url-status=bot: unknown|archive-url=https://archive.today/20161206132431/https://docs.docker.com/engine/userguide/storagedriver/selectadriver/|archive-date=2016-12-06}}</ref>

While most [Live CD](/source/Live_CD) linux distributions used [Aufs](/source/Aufs) as of November 2016, [Slackware](/source/Slackware) used overlayfs for its live CD.<ref>{{Cite web|url=http://docs.slackware.com/slackware:liveslak|title=slackware:liveslak - SlackDocs|website=docs.slackware.com|language=en|access-date=2017-06-05}}</ref>

==Implementation==
Here is an example of usage of OverlayFS, as part of {{mono|profile-sync-daemon}} for [web browser](/source/web_browser) profiles.

 Filesystem     1024-blocks   Used Available Capacity Mounted on 
 overlaid            337284 274960     62324      82% /run/user/1000/psd/vulcansphere-chromium 
 overlaid            337284 274960     62324      82% /run/user/1000/psd/vulcansphere-firefox-fwl7ugb8.default 
 overlaid            337284 274960     62324      82% /run/user/1000/psd/vulcansphere-firefox-17y0wmxk.default-release

The main mechanics of OverlayFS relate to the merging of directory access when both filesystems present a directory for the same name. Otherwise, OverlayFS presents the object, if any, yielded by one or the other, with the "upper" filesystem taking precedence. Unlike some other overlay filesystems, the directory subtrees being merged by OverlayFS do not necessarily have to be from distinct filesystems.<ref name="overlayfs-git-doc">{{cite web
|url= https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html?highlight=overlayfs
|title=OverlayFS documentation|publisher= kernel.org
}}</ref>

OverlayFS supports [whiteout](/source/whiteout_(filesystem_internals))s and opaque directories in the upper filesystem to allow file and directory deletion.<ref name=overlayfs-git-doc/>

OverlayFS does not support renaming files without performing a full copy-up of the file; however, renaming directories in an upper filesystem has limited support.

OverlayFS does not support merging changes from an upper filesystem to a lower filesystem.

==See also==
* [Aufs](/source/Aufs)
* [UnionFS](/source/UnionFS), an older union mount project

==References==
{{reflist}}

==External links==
* [https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html?highlight=overlayfs OverlayFS documentation]

{{File systems}}
{{Linux}}
{{Linux kernel}}

Category:Free special-purpose file systems
Category:Linux kernel features
Category:Special-purpose file systems supported by the Linux kernel
Category:Union file systems
Category:Unix file system technology

---
Adapted from the Wikipedia article [OverlayFS](https://en.wikipedia.org/wiki/OverlayFS) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/OverlayFS?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
