Mini-UnionFS is a small userspace union filesystem built with FUSE 3. It presents a merged view of a lower base directory and an upper writable directory. Upper-layer entries take precedence over lower-layer entries.
This is a minimal educational implementation, not a production-ready filesystem.
- Merged directory listings from the upper and lower layers
- Upper-layer precedence when a path exists in both layers
- Copy-on-write promotion of lower-layer files before writes or truncation
- Whiteout marker files (
.wh.<name>) to hide deleted lower-layer entries
On Linux, install a C compiler, GNU Make, pkg-config, and the FUSE 3 development files. The build uses pkg-config fuse3 to locate the FUSE headers and libraries.
For example, on Debian or Ubuntu:
sudo apt install build-essential pkg-config libfuse3-dev fuse3From the repository root:
makeThis produces the mini_unionfs executable. To remove it:
make cleanCreate the layer and mount-point directories first. The lower directory should contain the base files; the upper directory must be writable and should exist before mounting.
mkdir -p lower upper mnt
./mini_unionfs "$PWD/lower" "$PWD/upper" "$PWD/mnt"The filesystem is available at mnt while the FUSE process is running. Stop it with Ctrl-C if it is running in the foreground, or unmount it from another terminal:
fusermount3 -u "$PWD/mnt"Depending on your system's FUSE setup, you may need to add the allow_other option through your system's FUSE configuration; do not enable it unless you understand the access implications.
The repository includes test_unionfs.sh, which creates a temporary lower/upper/mount setup and exercises layer visibility, copy-on-write, and whiteouts. It expects the binary to have been built and requires permission to mount a FUSE filesystem:
make
bash test_unionfs.sh- Lower layer: base data, treated as the source for reads when no upper entry exists.
- Upper layer: writable changes and newly created files.
- Whiteouts: empty
.wh.<name>marker files in the upper layer hide matching lower-layer entries without removing the lower data.
Writes to lower-layer files first copy the file into the upper layer, leaving the lower copy unchanged.
Mini-UnionFS is intended for learning and experimentation. It implements only a subset of filesystem behavior and does not provide production-grade safety, completeness, or performance. Use disposable test data, and inspect the implementation before relying on it for important files.