Skip to content

A FUSE-based FAT32 knockoff that lets you create, read, write, and delete files and directories so you can actually see what happens under the hood.

Notifications You must be signed in to change notification settings

LordHerdier/cfat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CFAT File System

Purpose

The CFAT File System is a custom file system based on the FAT32 specification implemented using FUSE (Filesystem in Userspace). It aims to provide a simple yet functional file system for educational purposes. This file system supports basic file operations such as creating, reading, writing, and deleting files and directories. It also includes an interactive shell for easy manipulation and management of the file system. This has been created for the CS314 class, project 1 assignment.

Features

  • Create and manage files and directories.
  • Support for reading, writing, and listing directory contents.
  • File extraction to the local filesystem.
  • Interactive shell for direct file system manipulation.
  • Mount the custom file system to a directory.

Requirements

  • Libraries:
    • FUSE (libfuse-dev)
    • pkg-config
  • Compiler:
    • GCC or any compatible C compiler

Installation of Requirements

On a Debian-based system, you can install the required library using:

sudo apt-get install libfuse-dev pkg-config

Compilation

Using Make

A Makefile is provided for your convenience. To compile the project, simply run:

make

Using GCC

Alternatively, you can compile the program manually with:

gcc cfs.c -o cfs `pkg-config fuse --cflags --libs` --libs`

Usage Instructions

Running the Program

The program can be run with various options. Below are some common commands:

  • Create a new file system:

    ./cfs -f myfilesystem.CFAT -c
  • Load an existing file system:

    ./cfs -f myfilesystem.CFAT
  • List the contents of the file system:

    ./cfs -f myfilesystem.CFAT -l
  • Add a file to the file system:

    ./cfs -f myfilesystem.CFAT -a myfile.txt -i /myfolder/
  • Add a directory to the file system:

    ./cfs -f myfilesystem.CFAT -d /myfolder
  • Remove a file or directory from the file system:

    ./cfs -f myfilesystem.CFAT -r /myfolder/myfile.txt
  • Extract a file from the file system:

    ./cfs -f myfilesystem.CFAT -e /myfolder/myfile.txt
  • Mount the file system to a directory:

    ./cfs -f myfilesystem.CFAT -m /mnt/myfilesystem
  • Unmount the filesystem:

    fusermount -u /mnt/myfilesystem
  • Launch interactive mode:

    ./cfs -f myfilesystem.CFAT -I

Interactive Shell

Once in the interactive shell, you can use the following commands:

  • help - Show available commands.
  • exit - Exit the shell.
  • ls - List the contents of the current directory.
  • cd <internal path> - Change the current directory.
  • cat <internal path> - Display the contents of a file.
  • rm <internal path> - Remove a file or directory.
  • mkdir <internal path> - Add a directory.
  • tree - Display the directory tree.
  • addfile <path> <internal path> - Add a file.
  • touch <internal path> - Create/update the timestamp of a file.
  • extract <internal path> - Extract a file.
  • createfs <fsname> - Create a new file system.
  • loadfs <fsname> - Load a file system.
  • mount <mountpath> - Mount the file system at the specified point.

Potential Problems

  • Fle Name Limits: As this is based on the FAT32 spec, filenames are limited in size to 11 characters, including extension.
  • File Size Limits: Reading large files (>131KB) may have undocumented behavior.
  • Stability: There be dragons.Don't store your taxes in this.
  • Mounting Issues: CRUD operation generally work, but aren't bullet-proof.
    • Transport endpint is not connected: The program crashed. Run fusermount -d and re-mount.

Known Bugs

  • Attempting to edit a mounted file whose name is 11 characters long will result in a segfault
  • Using vim/emacs on a mounted file can be flaky. Nano seems to be more stable

Author

Charlie Whittleman Email: brennwh@siue.edu

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

A FUSE-based FAT32 knockoff that lets you create, read, write, and delete files and directories so you can actually see what happens under the hood.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published