This project is a user-level block-based filesystem developed using FUSE in C, implementing core features such as file creation, reading, writing, directory management, and RAID-level storage (RAID 0, RAID 1, RAID 1v). Designed as part of the Operating Systems curriculum (CS537), it demonstrates low-level filesystem logic including inode and block bitmap management, memory-mapped file I/O, and page-aligned metadata structures.
- Hrishikesh Shinde
- Ritik Singh
- Overview
- Key Features
- Usage
- Mounting Behavior
- Error Handling
- Testing
- Structure
- Debugging Tips
- Further References
- Contributors
The filesystem supports:
- Traditional block-based layout with inodes, bitmaps, and a superblock.
- RAID 0 (striping), RAID 1 (mirroring), and RAID 1v (verified mirroring).
- Verified mirroring performs majority-read validation across disks.
- Full integration with FUSE to support
mkdir,rmdir,read,write,unlink, and more.
This project is composed of:
mkfs.c– Initializes a new filesystem on given disk images.wfs.c– Entry point for the FUSE-based filesystem.fuse_operations.c– Contains the FUSE operation implementations.wfs.h– Contains all the filesystem structure definitions.- Utility scripts:
create_disk.sh,umount.sh,Makefile
- Block-aligned superblock, inode structures, and data blocks (512 bytes each)
- RAID 0 and RAID 1 support with metadata mirroring
- RAID 1v: Majority-based data verification during reads
- Lazy directory parsing and inode-based file structure
- Supports the following FUSE callbacks:
getattr,mknod,mkdir,unlink,rmdir,read,write,readdir
make./create_disk.sh # Modify this script to create multiple disks./mkfs -r 1 -d disk1 -d disk2 -i 32 -b 200mkdir mnt
./wfs disk1 disk2 -f -s mntmkdir mnt/dir
echo "data" > mnt/file
cat mnt/file
ls mnt- Filesystem must be mounted with the same number of disks used during formatting.
- Disk order during mount does not matter; disk image filenames can be changed.
- Filesystem mode (RAID 0, 1, 1v) is stored in the superblock.
- Valid modes:
-r 0,-r 1,-r 1v
The filesystem returns standard Linux error codes when appropriate:
-ENOENT: File or directory does not exist-EEXIST: File or directory already exists-ENOSPC: No space left on device
This repository includes a tests/ directory with functional tests to validate:
- File and directory creation
- RAID behavior (RAID 0, 1, and 1v)
- Reading and writing across block boundaries
- Mount and unmount correctness
- Edge cases like full disk, invalid flags, and max file size
To run tests:
make testmkfs.c– Formats disks with a fresh filesystem and metadata layoutwfs.c– Main function for FUSE mountingfuse_operations.c– Core filesystem logic and FUSE callbackswfs.h– Structs for superblock, inodes, dirents, and constantscreate_disk.sh– Script to create zeroed disk imagesumount.sh– Script to unmount the filesystemMakefile– Compiles all parts of the project
- Add
printf()statements inside each FUSE callback to trace execution. - Inspect raw disk contents with:
xxd -e -g 4 disk1 | less- Run the filesystem in
gdbwith:
gdb --args ./wfs disk1 disk2 -f -s mnt- Always
make cleanbefore testing or submitting.