Skip to content

nsvke/filesystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEMOFS --- A Simple Filesystem and Text-Based UI

demofs is a minimal filesystem experiment featuring a custom disk format running entirely on a simulated 1 MB virtual disk (disk.sim). The project is structured into two main components:

fs module — Layered Filesystem API

This module implements the core filesystem logic that manages the virtual disk. It is designed in two layers:

  • Low-level API (fs__* functions): Internal functions that directly manipulate disk blocks, inodes, and the superblock. They handle raw read/write operations and are not meant to be used by end users directly.

  • High-level API (fs_* functions): User-facing functions that abstract the underlying implementation. These functions perform operations like file creation, deletion, copying, backup, restore, integrity checking, and defragmentation by utilizing the low-level API.

This layered design gives the fs module the structure of a self-contained framework,

tui module:

Offers a minimal text-based user interface (TUI) for interacting with the filesystem. It allows you to create, edit, delete, and inspect files, manage backups, or test disk integrity through an interactive terminal menu system. This interface bridges the gap between the low-level filesystem logic and user interaction.

The goal of demofs is to provide a hands-on, educational environment for exploring filesystem design, storage management, and low-level data organization principles.

Screenshots

Main Menu

main menu

Usage

Build and Run

make clean && make

Run

make Run

Menus

Browse the file system

  • You can explore the entire file system through this menu.
  • Shortcut operations on the file system are not implemented yet, but they can be added.

Create a file

  • You can create a file from this menu.
  • Navigate to the location where you want to create the file and press 'Enter'. !!(You need to press it on the location, not inside a folder)
  • If the file metadata is full, if a file with the same name exists in that location, or if the disk is full, you will get an operation failed warning.
  • Error messages are not fully detailed based on the type of error yet, but invalid operations are prevented.

Delete a file

  • You can delete a file from this menu.
  • Navigate through the file system and press 'Enter' on the file/folder you want to delete.

Rename a file

  • Navigate through the file system, press 'Enter' on the file, and enter the new name.

Copy a file

  • First, select the file you want to copy from the file system, then select the destination location.

Move a file

  • First, select the file you want to move from the file system, then select the destination location.

Open a file in read mode

  • Navigate through the file system and press 'Enter' on the file/folder you want to read.
  • In this mode, you can also see the format of inode index and names inside folders if you are curious.

Open a file in write mode

  • Navigate through the file system and press 'Enter' on the file you want to open.
  • The selected file will open in a simple text editor where you can make changes.
  • [ctrl+s = save] [ctrl+x = exit]

Create a disk backup

  • A backup will be created as soon as you select this menu.

Restore a disk backup

  • A list of existing backups will be displayed. You can select the backup you want to restore.

Disk integrity test

  • A disk integrity test will be performed, and warnings will be displayed on the screen as well as written in detail to the relevant log files.

Reset the disk

  • If you select this menu, a confirmation step will appear. After confirming, the disk will be reset.

Exit the application

  • It is recommended to use this menu to exit the application safely. Even though disk metadata is backed up after important operations, exiting with a termination signal may cause some inconsistencies.

About

simple filesystem api and tui for learning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors