Project 6: The “Mirror” Filesystem (FUSE)

A user-space filesystem that mounts a folder. When you write to it, it reverses the text (or encrypts it) before saving to the underlying disk. This uses FUSE (Filesystem in Userspace) to hook into kernel VFS calls.

Quick Reference

Attribute Value
Primary Language C or Python
Alternative Languages Rust
Difficulty Level 3: Advanced
Time Estimate 1-2 weeks
Knowledge Area VFS / Filesystems
Tooling libfuse
Prerequisites C, Pointers, Project 3 (ls clone).

What You Will Build

A user-space filesystem that mounts a folder. When you write to it, it reverses the text (or encrypts it) before saving to the underlying disk. This uses FUSE (Filesystem in Userspace) to hook into kernel VFS calls.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Callback Implementation: Mapping read() requests to underlying file operations.
  • Permissions: Handling chmod/chown correctly.
  • Latency: User-space context switching overhead.

Key Concepts

  • VFS Interface: The common API for all filesystems.
  • Mount Points: How the kernel attaches filesystems.
  • User-Kernel Bridge: How /dev/fuse works.

Real-World Outcome

$ ./mirrorfs root_dir/ mount_point/
$ echo "Hello" > mount_point/test.txt
$ cat root_dir/test.txt
olleH

Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_LINUX_UNIX_INTERNALS_DEEP_DIVE.md
  • “Linux Kernel Development” (Filesystems chapter)