Skip to content

SamarthMahendra/User-Space-Unix-File-System-Implementation-FUSE-C-

 
 

Repository files navigation

fs5600 — A Unix-Style File System Built with FUSE

A fully functional Unix-like file system implemented from scratch in user space using FUSE (Filesystem in Userspace).

This project demonstrates deep understanding of operating systems, file system design, and low-level systems programming.

Built as part of an advanced OS curriculum, but engineered to production-quality standards.

This filesystem implements real OS concepts that production systems rely on:

  • Inodes and directory entries
  • Block allocation with bitmaps
  • Path traversal and name resolution
  • File metadata (permissions, ownership, timestamps)
  • Correct POSIX error handling
  • Read/write consistency through disk-backed storage
  • Integration with the Linux VFS layer via FUSE

You can mount this filesystem and use it like ext4:

ls
cat
mkdir
touch
mv
rm

Architecture Overview

Linux VFS
   ↓
FUSE Kernel Module
   ↓
User-Space FUSE Driver (fs5600)
   ↓
Disk Image File (test.img)

The filesystem runs as a user-space process, while Linux transparently forwards file operations to it through FUSE.

Disk Layout

Each disk is divided into 4KB blocks:

Block Purpose
0 Superblock
1 Block bitmap
2 Root directory inode
3+ Inodes and data blocks

Key Design Decisions

  • Block size: 4096 bytes
  • Inode size: 1 block (4096 bytes)
  • Max filesystem size: 128MB
  • Directories: Fixed-size (128 entries)
  • No hard/soft links (intentional simplification)

Implemented Features

Metadata & Navigation

  • stat, getattr
  • readdir
  • Permission bits (chmod)
  • Ownership (uid / gid)
  • POSIX timestamps (ctime, mtime)

File Operations

  • Create / delete files
  • Read & write arbitrary byte ranges
  • Rename within directory
  • Truncate files
  • Persistent storage backed by disk image

Directory Operations

  • Create & remove directories
  • Enforce empty-directory deletion rules
  • Name validation & path resolution

Error Handling

Fully POSIX-compliant error codes:

  • ENOENT, ENOTDIR, EISDIR
  • EINVAL, ENOMEM, EIO, ENOTEMPTY

Technology Stack

  • C (low-level systems programming)
  • Linux FUSE
  • POSIX filesystem semantics
  • Bitmap-based block allocation
  • Unit testing (Check framework)

Example Usage

make
mkdir fs
./lab5fuse -image test.img fs
cd fs
mkdir demo
echo "hello world" > demo/file.txt
cat demo/file.txt
fusermount -u fs

The filesystem behaves exactly like a native Linux filesystem.

Testing & Validation

39+ unit tests covering:

  • Path resolution
  • Metadata correctness
  • File and directory semantics
  • Error handling edge cases
  • Deterministic disk images for reproducibility
  • Verified against reference filesystem behavior

About

simplified Unix-style file system implemented in user space using FUSE. It supports core POSIX file operations and uses a disk image as backing storage, including superblock management, block bitmaps, inodes, and directory structures.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 89.8%
  • Python 8.2%
  • Shell 1.3%
  • Makefile 0.7%