Skip to content

About

Mini-UnionFS, a simplified Union File System running in userspace using FUSE (Filesystem in Userspace).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

Mini-UnionFS

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.

Features

  • 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

Requirements

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 fuse3

Build

From the repository root:

make

This produces the mini_unionfs executable. To remove it:

make clean

Run

Create 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.

Test script

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

How the layers work

  • 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.

Limitations

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.

About

Mini-UnionFS, a simplified Union File System running in userspace using FUSE (Filesystem in Userspace).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages