AltFileSystem is a functional Linux file system written in C wrapped in FUSE (Filesystem in Userspace).
AltFileSystem a.k.a Altfs provides functionalities to mount and unmount the filesystem and supports all (almost :P) the capabilities that is required of a Linux filesystem.
- Libfuse 3
NOTE: Currently, the filesystem assumes the disk to be /dev/vdb. We will make this a configurable parameter shortly. The device name and filesystem size are currently configurable through the header/disk_layer.h
file.
dnf -y update
dnf -y install gcc g++ fuse fuse3-devel autoconf git
git clone ~/https://github.com/bhavyejain/AltFileSystem.git
cd ~/AltFileSystem && make clean && make mkaltfs && make filesystem
- Create a directory which will be used as the mount point. Example -
mkdir ~/mnt
- Run our makefs equivalent using
./AltFileSystem/mkaltfs
- Mount the filesystem using
./AltFileSystem/bin/altfs -s ~/mnt
The filesystem is now ready to use at~/mnt
. - To unmount, run
fusermount -u ~/mnt
- To debug AltFS, make the filesystem in debug mode:
make filesystem_debug
- To debug and display logs, instead of running step 3 in previous section, run
./AltFileSystem/bin/altfs_debug -d -s ~/mnt
This will run FUSE in the foreground and display logs as each operation is performed in the filesystem. - If you wish to view more selective logging, run
./AltFileSystem/bin/altfs_debug -f -s ~/mnt
. - Access and perform the filesystem operations on a separate terminal window.
Development is aided by a suite of unit and e2e tests. For initial development cycle, in-memory unit tests provide a fast and no-setup option. For on-disk validation, e2e tests provide high-level test cases.
The unit tests are numbered in an increasing order corresponding to their position in the stack. They are intended to be run in the same order while testing the filesystem in its entirity. A failing lower test almost nullifies any guarantees by a higher numbered test.
- The
run_tests.sh
provides for automatically building and running all tests in order, or a selected test. To run all tests, use:./run_tests.sh
. To run a specific test, add the name of the test as an argument:./run_tests.sh 01_disk_layer
. All tests are run in-memory. make unit_tests
builds all the unit tests in 'in-memory' mode (no data is written on disk).- Each test can be made individually as
make <testname-without-extension>
, e.g.:make 01_disk_layer
. - The interface layer test can be made to run on the disk as well:
make test_interface_layer_disk
. It is a good idea to run this test on disk at the end of making any changes. Tests can be toggled by commenting out the function call in main().
All e2e tests are intended to be run on disk. AltFS must be mounted beforehand. Clone the repository inside the mountpoint (or copy the e2e test folder). Make the test(s) and run them inside the mount point.
make all
will build all tests.- Each individual test can be built in the same was as described for unit tests.
- These tests need not be run in order.