UnionFS

From Wikipedia, the free encyclopedia

UnionFS is a Linux filesystem service which implements a union mount for Linux file systems. It allows files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system. Contents of directories which have the same path within the merged branches will be seen together in a single merged directory, within the new, virtual filesystem.

The different branches may be read-only or read-write file systems, so that writes to the virtual, merged copy can be directed to a specific real filesystem. This leads to one other useful purpose for union mounts, which is to make a filesystem appear as writeable, but without actually allowing writes to change the filesystem, also known as copy-on-write. This may be desirable when the media is physically read-only, such as in the case of CDROMs, or for using a single common template for a number of filesystems, or perhaps for security reasons. The Linux implementation, UnionFS, is sometimes used as an ad-hoc snapshotting system.

When mounting branches the priority of one branch over the other is specified. So when both branches contain a file with the same name one gets priority over the other.

UnionFS in Linux is generally not recommended for production use.

On LiveCDs it is used as a way of overlaying a writeable file system on top of read-only media. In KNOPPIX for example the union of the file system on the CD-ROM or DVD may be made with the file system contained in an image file called knoppix.img on a USB memory stick which has priority over the read-only filesystem. The user sees then a logical file system where it is possible to add and change files anywhere. What happens on the physical level is that if a file which resides in the read-only branch is replaced by a new version it is put into the image file. As the union file system merges the two branches transparently the user just sees the new version.

[edit] Other implementations

Plan 9 from Bell Labs operating system uses union mounts extensively to build custom namespaces per user/processes. The same concept, implemented as "union mount" has also been available in BSD, for at least ten years.

Several previous attempts have been made to add this feature to Linux, but none was maintained for long. For quite a while Linux has had the bind mount feature, which allows attaching a directory in more than one location in the filesystem, and this feature is present in other operating systems including MSDOS, but this is a completely different concept to union mounts.

[edit] References

[edit] External links

In other languages