Giter Club home page Giter Club logo

altfilesystem's Introduction

AltFileSystem

AltFileSystem is a functional Linux file system written in C wrapped in FUSE (Filesystem in Userspace).

Overview

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.

Dependencies

  • Libfuse 3

Installation

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.

Building AltFS on CentOS 9

  1. dnf -y update
  2. dnf -y install gcc g++ fuse fuse3-devel autoconf git
  3. git clone ~/https://github.com/bhavyejain/AltFileSystem.git
  4. cd ~/AltFileSystem && make clean && make mkaltfs && make filesystem

Initializing the file system

  1. Create a directory which will be used as the mount point. Example - mkdir ~/mnt
  2. Run our makefs equivalent using ./AltFileSystem/mkaltfs
  3. Mount the filesystem using ./AltFileSystem/bin/altfs -s ~/mnt The filesystem is now ready to use at ~/mnt.
  4. To unmount, run fusermount -u ~/mnt

Debug and logging information

  1. To debug AltFS, make the filesystem in debug mode: make filesystem_debug
  2. 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.
  3. If you wish to view more selective logging, run ./AltFileSystem/bin/altfs_debug -f -s ~/mnt.
  4. Access and perform the filesystem operations on a separate terminal window.

Development

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.

Unit Tests

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.

  1. 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.
  2. make unit_tests builds all the unit tests in 'in-memory' mode (no data is written on disk).
  3. Each test can be made individually as make <testname-without-extension>, e.g.: make 01_disk_layer.
  4. 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().

E2E Tests

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.

  1. make all will build all tests.
  2. Each individual test can be built in the same was as described for unit tests.
  3. These tests need not be run in order.

Contributors

altfilesystem's People

Contributors

bhavyejain avatar swathisbhat avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

altfilesystem's Issues

Add documentation

  • VM setup
  • Mail service installation
  • Fuse installation
  • Project build
  • Project run

Complete permission management.

Understanding is required on where FUSE handles permissions and where the filesystem needs to do that. The interface layer must be updated accordingly and tests added for the same.

Un-hardcode device path and filesystem size.

Currently, the filesystem size and the disk storage device path are hardcoded in header/disk_layer.h. We should add a shell script that compiles the filesystem with relevant flags to define the disk path and filesystem size during compilation and mounts it on the given disk path.

The same needs to be done for mkaltfs.

Improve free inode search in the ilist.

Currently, a linear scan of the inode blocks is required to fetch the next free inode. Possibly add another field at the end of an inode ssize_t i_next_free_inum and use it to form a linked list of sorts like the freelist. Addition and removal to be done from the head. This ensures O(1) fetch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.