A Linux-inspired Virtual File System written in C that simulates inode-based file management similar to Unix file systems.
A Custom Virtual File System (CVFS) implemented in C Programming that simulates the internal working of a Linux file system.
This project demonstrates how operating systems manage files using inodes, file descriptors, and memory management.
The CVFS project is a command-line based system programming project that replicates file system behavior such as:
- File Creation
- File Opening
- File Reading
- File Writing
- File Deletion
- File Information Display
- Command Manual System
The entire system runs in RAM using dynamic memory allocation.
- Understand Linux File System Architecture
- Implement inode-based file management
- Simulate file operations
- Learn System Programming Concepts
- Strengthen Data Structures knowledge
| Technology | Purpose |
|---|---|
| C Programming | Core implementation |
| Data Structures | Inode and file management |
| Dynamic Memory Allocation | File storage |
| GCC Compiler | Compilation |
| CLI (Command Line Interface) | User interaction |
The system uses Command Line Interface (CLI).
Example commands:
create file1 3
open file1 3
write file1
read file1 10
ls
unlink file1The CVFS system is composed of the following components:
User Commands
|
v
+-------------------+
| Command Parser |
+-------------------+
|
v
+-------------------+
| UFDT |
| (File Descriptor) |
+-------------------+
|
v
+-------------------+
| File Table |
+-------------------+
|
v
+-------------------+
| Inode |
+-------------------+
|
v
+-------------------+
| Data Blocks |
+-------------------+
Tracks total and free inodes.
struct SUPERBLOCK
{
int TotalInodes;
int FreeInodes;
};Represents file metadata.
struct inode
{
char FileName[50];
int InodeNumber;
int FileSize;
int FileActualSize;
int FileType;
char *Buffer;
int LinkCount;
int ReferenceCount;
int Permission;
struct inode *next;
};Stores information of opened files.
struct filetable
{
int ReadOffset;
int WriteOffset;
int Count;
int Mode;
struct inode *ptrinode;
};Maps file descriptors to file tables.
struct ufdt
{
struct filetable *ptrfiletable;
};| Command | Description |
|---|---|
create <name> <permission> |
Create new file |
open <name> <mode> |
Open file |
read <name> <size> |
Read file |
write <name> |
Write into file |
close <name> |
Close file |
ls |
List all files |
unlink <name> |
Delete file |
man <command> |
Display command manual |
help |
Display all commands |
exit |
Exit CVFS |
Start Program
|
Initialize Superblock
|
Create Inode Linked List
|
Accept User Command
|
Parse Command
|
Execute Function
|
Display Output
|
Repeat Until Exit
gcc cvfs.c -o cvfs./cvfsCVFS : > create file1 3
File created successfully with file descriptor : 0
CVFS : > write file1
Enter data : Hello World
CVFS : > read file1 11
Hello World
CVFS : > ls
file1
CVFS : > unlink file1
File deleted successfully
CVFS > create file1 3
File created successfully
CVFS > read file1 11
Hello World
CVFS > ls
file1
CVFS > unlink file1
File deleted successfully
- Data stored only in RAM
- No directory structure
- Limited inode count
- No multi-user support
- Persistent storage
- Directory support
- Multi-user system
- File encryption
- GUI interface
This project helps understand:
- File System Architecture
- Inode-based File Management
- File Descriptors
- Memory Management
- System Programming
Sahil Rajaram Thorat
- π Pune, Maharashtra
- π» C / C++ / Java Developer
- π GitHub: https://github.com/SahilThorat11
β If you like this project, give it a star on GitHub!