Code Monkey home page Code Monkey logo

gotenksfs's Introduction

GotenksFS

GotenksFS is a file system built for learning purposes. The disk is represented as a regular file which is created using the mkfs command provided by this binary. A mount command is also available for mounting the file system using FUSE.

For a more in-depth overview of this project, read the blog post: Writing a file system from scratch in Rust.

Layout

The first 1024 bytes of the "disk" hold the superblock with the metadata about the file system. When mkfs is executed, the "disk" is divided into fixed-size blocks. With the exception of the superblock, all data is written in these blocks. The size can be configured to be either 1 KiB, 2 KiB, or 4 KiB.

Blocks are grouped in block groups. The first two blocks in each block group are used for the data and inode bitmaps. Following that, there is the appropriate number of blocks for storing the inode table. As an example, inodes have a size of 128 bytes which means that for a block size of 4 KiB there will 32768 inodes in the bitmap which will require 1024 blocks for the inode table. After the inode table, the remaining blocks are used for user data. In this example, 32768 blocks taking 128 MiB to be exact.

Each inode has 12 direct pointers. The system supports larger files by using double indirect pointers. Considering blocks of 4 KiB, this means the maximum size a file can have is 4 GiB. The file system could theoretically be up to 16 TiB in size.

Example

First we need to create the disk image:

$ ./gotenksfs mkfs disk.img -s "10 GiB" -b 4096

Then mount it:

$ ./gotenksfs mount disk.img gotenks

The following image shows the file system in action.

Usage

gotenksfs
A file system on top of your file system

USAGE:
    gotenksfs [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    help     Prints this message or the help of the given subcommand(s)
    mkfs     Create a new file system
    mount    Mount a file system

gotenksfs's People

Contributors

carlosgaldino 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.