This project is an advanced simulation of a virtual file system written in Go. It demonstrates key concepts in operating system design, including memory-mapped storage, free space management, inodes, and hierarchical directories.
- Memory-Mapped Persistence: Uses
mmap-goto map a 10MB virtual disk (virtual_disk.bin) into memory, ensuring real-time persistence of changes. - Free Space Bitmap: Precisely tracks which 4KB blocks are used and which are free to allow for block reuse.
- Inodes: Implements an inode table with Unix-style permissions (
rwxrwxrwx) and Indexed Allocation pointers. - Directories: Simulates hierarchical directories using
DirEntrymappings. - Interactive Shell: A custom CLI to interact with the virtual disk.
Ensure you have Go installed, then clone the repository and build the shell:
go mod tidy
go build -o fs-shell ./cmd/shellRun the interactive shell:
./fs-shellinfo: Display information about the virtual disk.ls: List contents of the current directory.mkdir <dirname>: Create a new directory.rm [-r] <name>: Remove a file or directory. Use-rto forcefully remove a directory.exit: Unmount the disk and close the shell.
The older, simplified simulations are still available for reference:
- example1/: Contiguous file system simulation.
- example2/: Paged file system simulation.
- chunks/: Chunk calculation test.
This project is licensed under the terms of the MIT License.