Welcome to WFS – a custom filesystem implementation built using the FUSE (Filesystem in Userspace) framework with support for RAID 0 and RAID 1 configurations. This project demonstrates the creation of a block-based filesystem that integrates basic filesystem operations such as file creation, reading, writing, directory management, and file deletion, with additional capabilities for RAID configurations.
This project aims to provide hands-on experience in developing a filesystem from scratch using C and the FUSE framework. It also introduces the concept of RAID (Redundant Array of Independent Disks), offering both RAID 0 (striping) and RAID 1 (mirroring) modes. RAID support ensures improved performance, redundancy, and fault tolerance.
Key Highlights:
- Implemented a custom filesystem (WFS) based on FUSE, supporting basic filesystem operations.
- Integrated RAID 0 and RAID 1, providing striped and mirrored data storage for enhanced reliability and performance.
- Simulated filesystem operations like file creation, reading, writing, and deletion, along with directory manipulation.
- RAID Support: Seamless support for RAID 0 (Striping) and RAID 1 (Mirroring), ensuring better performance and fault tolerance.
- Filesystem Operations: Implements core filesystem operations including:
getattr
– Fetch file or directory attributesmknod
– Create files and directoriesmkdir
– Create new directoriesunlink
– Remove filesrmdir
– Remove directoriesread
– Read data from fileswrite
– Write data to filesreaddir
– List the contents of directories
- File & Directory Management: Handles creation, reading, and deletion of files and directories.
- RAID 0 (Striping): Distributes data across multiple disks for improved performance.
- RAID 1 (Mirroring): Duplicates data across multiple disks for enhanced fault tolerance and reliability.
- Filesystem Metadata Mirroring: Metadata (including superblock and inode data) is mirrored across multiple disks to ensure data integrity.
-
Clone the repository:
git clone https://github.com/yourusername/WFS.git cd solution
-
Build the project:
make
-
Create disk images: Use the provided
create_disk.sh
script to create disk images:./create_disk.sh disk1.img ./create_disk.sh disk2.img
-
Make sure all necessary disk images are created before proceeding.
-
Create a filesystem:
./mkfs -r 1 -d disk1.img -d disk2.img -i 32 -b 200
This command creates a filesystem with RAID 1 configuration, 32 inodes, and 200 data blocks, using two disks.
-
Mount the filesystem:
mkdir mnt ./wfs disk1.img disk2.img -f -s mnt
This mounts the filesystem at the
mnt
directory. -
Perform basic filesystem operations:
- Create a file:
touch mnt/myfile.txt
- Write to the file:
echo "Hello, WFS!" > mnt/myfile.txt
- Read from the file:
cat mnt/myfile.txt
- Create a file:
-
Unmount the filesystem:
./umount.sh mnt
-
RAID 0 (Striping):
- Provides increased performance by splitting data across multiple disks.
- Data is written in chunks (512 bytes) to each disk in a round-robin fashion.
- Use the
-r 0
flag when creating the filesystem:./mkfs -r 0 -d disk1.img -d disk2.img -i 32 -b 200
-
RAID 1 (Mirroring):
- Mirrors data across multiple disks for redundancy, ensuring no data loss in case of a disk failure.
- Use the
-r 1
flag when creating the filesystem:./mkfs -r 1 -d disk1.img -d disk2.img -i 32 -b 200
-
RAID 1v (Verified Mirroring):
- A verified version of RAID 1 that compares data across multiple disks during read operations, ensuring data integrity.
- Use the
-r 1v
flag when creating the filesystem:./mkfs -r 1v -d disk1.img -d disk2.img -i 32 -b 200
- mkfs.c: Initializes the filesystem, sets up RAID configurations, and writes the superblock and inode information to disk.
- wfs.c: Implements the FUSE filesystem, handling operations like file reading, writing, and directory management.
- wfs.h: Contains the structure definitions and constants used throughout the filesystem.
- create_disk.sh: A helper script to create disk image files.
- Makefile: A build script to compile the project.