unionfs(8)
π unionfs(8) β the manual, but make it make sense
okay so bestie, welcome to unionfs(8) β yes that's the page name, that's the vibe, we're doing this. this is unionfs-fuse, and I'm gonna walk you through the whole thing like we're on facetime and I actually want you to pass your exam. π«Ά
β¨ NAME β¨
unionfs-fuse β a userspace unionfs implementation. that's it, that's the name, she's simple, she's iconic, she does one thing and she does it well π
πΈ SYNOPSIS πΈ
unionfs [-o option1 -o option2 ... -o optionN ]
top_branch:lower_branch:...:lowest_branch
mount_point
like⦠you stack a bunch of branches on top of each other, you give her a mount point, and she slays. the options are all optional-ish, the branches and the mount point are the moment. periodt.
π¦ DESCRIPTION π¦
so unionfs overlays several directories into one single mount point. one mount point, many directories, all merged into one gorgeous little view. it's giving "why choose" energy.
here's the actual mechanics, no cap: she first tries to access the file on the top branch, and if the file isn't there, she just keeps going down, lower and lower level branches, until she finds it. like scrolling until you find the one.
and then β the cute part β if you try to modify a file on a lower level read-only branch while copy-on-write (cow) mode is enabled, the file gets copied up to a higher level read-write branch. she doesn't touch your read-only stuff, she just makes a little copy higher up. respectful. π
π OPTIONS π
below is a summary of unionfs options. yes, all of them. I'm not skipping a single one, bestie, we're thorough in this house.
-o chroot=pathβ path to chroot into. by using this option,unionfsmay be used for live CDs or live USB sticks, etc. so it can serve"/"as filesystem. β οΈ heads up: if you do not specify this option and you try to use it for"/", it will deadlock on callingpivot_rootβ like, full on freeze, not cute. and if you do set this option, you also need to specify the branches relatively to the given chroot directory. seeexamples/S01a-unionfs-live-cd.shfor an example. iykyk π-o cowβ enable copy-on-write. that's the whole thing. go off.-o hide_meta_filesβ okay so in our unionfs root path we have a.unionfsdirectory that includes metadata, such as hidden (deleted) files. this option makes this directory invisible fromreaddir(), so for examplels -la /union_rootwill not show it. π however β and this is the plot twist β this directory is still there andcd .unionfsorls -l .unionfsstill work. also,libfusewill create.fuse_hidden*files if a file is open but will be deleted, and those fuse meta files will be invisible as well. this option is especially useful for package builders. π-dβ enable debugging forunionfsandlibfuse. useful for developers if the code does not behave as expected. debug information will be written tostderrand a debug file (./unionfs_debug.logby default). two places. overachiever behavior, love that.-o debug_file=fileβ write unionfs debug information into that file. pick your own destination, main character choice.-o max_files=numberβ maximum number of open files. most systems have a default limit of 1024 open files per process. for example ifunionfsserves"/", applications like KDE or GNOME might have many open files, making the unionfs process reach this limit and become unable to open further files. suggested value for"/"is >16000 or even >32000 files. like she needs room to breathe, okay?? π-o noinitgroupsβ since version 0.23 without any effect, just left over for compatibility. might be removed in future versions. she's retired but still shows up to the group chat π-o relaxed_permissionsβ usually we automatically add thelibfuseoption-o default_permissionsso thatlibfusetakes over permission checks. however, if running not as root (so asUID != 0andGID != 0), permissions on the underlying filesystem are already sufficient. and in order to prevent severe security issues, this option is not allowed if running as root. π¨ read that again. not allowed as root. fr fr.-o statfs_omit_roβ by default, blocks of all branches are counted instatfs()calls (e.g. bydf). with this option, read-only branches will be omitted from the summary of blocks. this may sound weird, but it actually fixes "wrong" percentage of free space. she's not being quirky, she's being correct π
π Options to libfuse π
there are several further options available which don't directly apply to unionfs, but to libfuse. please run unionfs --help to see these. and btw, we already set -o default_permissions option on our own β we got you, bestie π«Ά
π₯ EXAMPLES π₯
look at her go:
unionfs -o cow,max_files=32768 \
-o allow_other,use_ino,suid,dev,nonempty \
/u/host/etc=RW:/u/group/etc=RO:/u/common/etc=RO \
/u/union/etc
iconic. ate. no notes. β¨
π§ Meta data π§
like other filesystems, unionfs also needs to store meta data. well, presently only information about deleted files and directories needs to be stored, but in future releases more information might be required, e.g. inode-numbers for persistent inode information.
meta data information are saved and looked for in the .unionfs/ directories of each branch-root. so in the example above, these are:
/u/host/etc/.unionfs/u/group/etc/.unionfs/u/common/etc/.unionfs
within these directories a complete directory structure may be found.
example time πΈ: if the admin decides to delete the file /etc/test/testfile, which only exists in /u/unionfs/etc/test/testfile, unionfs can't delete this file, since it is on a read-only branch. so instead the whiteout file /u/host/etc/.unionfs/test/testfile_HIDDEN~ will be created. so on accessing the union filesystem, test/testfile will not be visible. she's not deleting, she's hiding. there's a difference π
please also note that whiteout files/directories will only hide the files in lower level branches. so for example whiteouts in the group directory (/u/group/etc/.unionfs of the example above) will only hide files of the common branch (/u/common/etc), but not these of the group and host branches. hierarchy matters, bestie.
and especially for diskless-booted environments it is rather useful for the admin to create whiteout files him/her-self. for example one should blacklist network re-initializations, /etc/mtab, /etc/nologin of the server, and several cron-scripts. this can be easily achieved by creating whiteout files for these scripts in the group meta directory. you're the admin, you're the main character, go hide things responsibly π
π KNOWN ISSUES π
- another issue is that presently there is no support for read-only branches when copy-on-write is disabled, thus,
-ocowis NOT specified! support for that might be added in later releases.
yes that's genuinely a real limitation, not me being dramatic. if cow is off, read-only branches aren't supported. noted. logged. respect the constraint. π
π AUTHORS π
unionfs-fuse original implementation by Radek Podgorny <radek@podgorny.cz> β founder of the vibe, we stan. π«Ά
π COPYRIGHT π
Radek Podgorny <radek@podgorny.cz>, Bernd Schubert <bernd-schubert@gmx.de>
π THANKS π
many thanks to the author of the FUSE filesystem Miklos Szeredi. legend behavior, honestly. π
and that's the whole page, bestie!! this was unionfs-fuse version 3.4, dated 2022, and you can find her under unionfs(8) any time you need her. now go mount something. slay π
β¨π
π¦ where this page comes from
- alpine 3.22: unionfs-fuse-doc 3.4-r0 Β· BSD-3-Clause
- alpine 3.23: unionfs-fuse-doc 3.4-r1 Β· BSD-3-Clause
- alpine 3.24: unionfs-fuse-doc 3.4-r1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms