UnionFS - A Stackable Unification File System

Translation of the original in Catalan. Read it in: CatalàCastellano

unionFS is a linux file system, it really is a dream come true, in principle it lets us do something quite simple. As the title says, it lets you join file systems by stacking them. What does that mean? well, mounting one file system on top of another. Where is the trick? well, in that for example we can mount a read-only file system and then a read-write one on top of it; the difference between this and a conventional mount is that we will see the contents of both directories and we will be able to modify the read-only system, saving the changes in the read-write one. In other words, now we have a new virtual system made up of the union of both systems. I think with this example the power of the idea is crystal clear.

This file system can also be used with snapshots support. In other words, keeping past copies of the previous versions of the files. So, the system of modifying files that unionFS uses is called copy-on-write, because when it has to write a file what it does is make a copy keeping the old content in one of the file systems that are in the union.

When file systems with different branches of the same files are mounted, priority is usually given to one of the branches. If what we have mounted is a CDROM and a hard disk, obviously the branch that has to have priority is the hard disk one, otherwise the changes could not be saved.

unionfs.png
esquema unionFS

The most notable use made of this file system is in liveCDs, because they allow data to be saved persistently on a hard disk or on a pendrive. In other words, we can boot a linux distribution from a CD or DVD and install new packages, make changes to the system configuration, save data with applications, etc. and all the new data that should have been saved to the read-only medium will have been saved to the hard disk or the pendrive thanks to unionFS. Many of the liveCDs of your favourite distributions support what is called persistent mode, I recommend you check the documentation if you are interested in the feature.

For more information: Versatility and Unix Semantics in a Fan-Out Unification File System (local).

1 comment

Comments from the old blog, as they were written. Comments are closed.

  1. —

    He trobat aquest article a la LinuxJournal que parla de forma una mica més pràctica sobre l'unionfs:

    Kernel Korner - Unionfs: Bringing Filesystems Together (local)