Mini UnionFS is a user-space filesystem built using FUSE that combines two directories:
- Lower directory (read-only base layer)
- Upper directory (writable layer)
The mounted directory presents a unified view of both layers.
-
Read files from lower and upper layers
-
Copy-on-Write (CoW)
- Modifying a file from lower copies it to upper
-
File creation in upper layer
-
File deletion using whiteouts (
.wh.*) -
Merged directory view (no duplicates)
-
Hides deleted lower-layer files
.
├── include/ # Header files
├── src/ # Source code
├── test_env/ # Test directories (lower, upper, mount)
├── tests/ # Test scripts
├── Makefile
└── README.md
- Linux / WSL (Ubuntu recommended)
- FUSE3 installed
Install dependencies:
sudo apt update
sudo apt install fuse3 libfuse3-dev
make clean
make
This generates the executable:
mini_unionfs
mkdir -p test_env/lower test_env/upper test_env/mnt
Add sample files:
echo "base_only_content" > test_env/lower/base.txt
echo "to_be_deleted" > test_env/lower/delete_me.txt
./mini_unionfs test_env/lower test_env/upper test_env/mnt
Keep this terminal running.
cd ~/mini_unionfs
cat test_env/mnt/base.txt
echo "modified_content" >> test_env/mnt/base.txt
rm test_env/mnt/delete_me.txt
ls test_env/mnt
Expected:
base.txt
fusermount -u test_env/mnt
Make scripts executable:
chmod +x tests/*.sh
Run tests:
bash tests/test_cow.sh
bash tests/test_whiteout.sh
bash tests/test_unionfs.sh
bash tests/test_posix.sh
- Files from lower are copied to upper before modification
- Deleting a file creates:
.wh.filename
- This hides the file from the lower layer
- Combines upper + lower contents
- Removes duplicates
- Respects whiteouts
- Always run inside WSL/Linux (not directly on Windows paths)
- If mount fails:
fusermount -u test_env/mnt
chmod 777 test_env/mnt