Giter VIP home page Giter VIP logo

mini-fs's Introduction

Mini-FS : A Container-Based Filesystem

Mini-FS is a containerized filesystem built on FUSE (Filesystem in Userspace). It operates by mounting a container file, allowing all files and directories created within the mount point to be stored within this container file.

Table of Contents

Installation

This project has been tested on Archlinux with Rust 1.77.

Dependencies

This project relies on the following crates:

  • FUSE and the Rust crate fuser for handling filesystem-related calls.
  • notify-rust for desktop notifications.
  • serde and bincode for binary serialization.
  • heapless for easily serializable structures.
  • clap for parsing command-line parameters.
  • anyhow for handling errors throughout the entire program.

[FUSE for Linux] is available in most Linux distributions and usually called fuse or fuse3. See installation guide for most distributions.

Compilation

cargo build

Tests

Mini-FS includes unit tests that can be executed as follows:

cargo test

Additionally, there's a basic filesystem test script provided. After mounting a container filesystem on mountpoint/ (refer to usage), run the following command:

./test.sh mountpoint

This script conducts file creation, reading, writing, and deletion operations based on basic shell operations.

Usage

To mount the container file container_file to ./mountpoint/, follow these steps:

mkdir mountpoint
./target/debug/mini-fs mountpoint container_file

Once mounted, you can use mountpoint/ as a directory, and all files and directories will be stored in container_file. For example:

mkdir mountpoint/ocean
echo "Whale swim like otters" > mountpoint/ocean/whale.txt
cat mountpoint/ocean/whale.txt

This creates a directory ocean inside mountpoint/, writes a text file whale.txt with the specified content, and then displays the contents of whale.txt.

Notification

Mini-FS features a basic notification system that can be enabled using the option -n or --allow-notification.

To enable notifications, use one of the following commands:

./target/debug/mini-fs mountpoint container_file -n
./target/debug/mini-fs mountpoint container_file --allow-notification

However, be cautious as enabling this feature may result in frequent notifications, which could potentially become very annoying.

Limitations and Optimization Opportunities

Mini-FS is not a fully-fledged filesystem and lacks several operations, including:

  • Removing a directory.
  • Changing file permissions (currently fixed at 777).
  • Renaming files or directories.
  • Names limited to 30 bytes.
  • (Probably) not thread-safe.

Additionally, the container structure exhibits some inefficiencies that could be addressed for improved performance:

  • Excessive read and write operations.
  • Failure to release sectors when directories or files are truncated.
  • Absence of a cache system.
  • Fragmentation issues.

License

Dual-licensed under Apache 2.0 or MIT.

mini-fs's People

Watchers

Martin avatar

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.