This project implements a read-write version of a Unix-like file system using the FUSE (File system in User SpacE) library. The implementation follows the specifications provided in the project description.
This project is designed to run on an x86 Linux VM. All development and testing was done in this environment.
Before running the project, you need to install the following packages:
sudo apt install check # libcheck for testing
sudo apt install libfuse-dev # FUSE development libraries and headers
sudo apt install python3 # Python 3
sudo apt install python-is-python3 # Makes python command point to python3To build the project, simply run:
makeThis will compile the source files and create the necessary executables.
There are two test suites for this project:
These tests verify the read-only operations of the file system:
./unittest-1This will generate a predefined disk image named test.img and run tests for:
fs_init- constructorfs_getattr- get attributes of a file/directoryfs_readdir- enumerate entries in a directoryfs_read- read data from a filefs_statfs- report file system statisticsfs_rename- rename a filefs_chmod- change file permissions
These tests verify the write operations of the file system:
./unittest-2This will generate a disk image named test2.img and run tests for:
fs_create- create a new (empty) filefs_mkdir- create new (empty) directoryfs_unlink- remove a filefs_rmdir- remove a directoryfs_truncate- delete the contents of a filefs_write- write to a filefs_utime- change access and modification times
You can also mount the file system and interact with it directly:
mkdir mnt
./hw3fuse -image test.img mntThis will mount the file system in the mnt directory. You can then navigate the file system using standard commands:
ls mnt
cd mnt
cat mnt/file.1kWhen you're done, unmount the file system:
fusermount -u mntTo debug with GDB, use the following command:
gdb --args ./hw3fuse -s -d -image test.img mntThe -s flag specifies single-threaded mode, and -d specifies debug mode so it runs in the foreground.
- Make sure to unmount the file system with
fusermount -uif the program crashes. - The test images are regenerated each time you run the tests to ensure a clean state.
- The file system is limited to 128MB in size and files cannot be larger than about 4MB due to the implementation.