Skip to content

A Linux Compatible Ext2 File System that creates its own disk on startup or uses existing disks and can preform common linux commands like ls, cd, pwd, mkdir, rmdir, read, write, open, link, symlink, and etc.

Notifications You must be signed in to change notification settings

mitchellkolb/ext2-file-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ext2 File System

Github top language Github language count Repository size Github stars

Website Badge Website Badge Website Badge

This project is a Linux-compatible ext2 file system. The project deliverables were comprised of two primary sections. The first level was expanding the base file system to implement the file system tree. Second level focuses on implementing read and write operations of file contents.

ext2-examplt-gif

Watch the Full Video Demo Here

Full Video Demo Here


Table of Contents


What I Learned in this Project

  • Extreme detail of the Linux Ext2 File System
  • Techniques for programming in C using data structures and file operations
  • How to create and use shell scripts and virtual disks
  • What all these topics are: Inodes, MBR (Master Boot Record), Super Block, Group/File Descriptor, Bitmap, Indirect Blocks, Forks/Pipes, and Mailman's Algorithm.

Tools Used in this Project

  • C programming language
  • Systems Programming in Unix/Linux Textbook
  • Linux distribution (Ubuntu) used in a Virtual Machine
  • Ext2 file system library
  • WSU Managed Github Repository

Development Environment

  • VS Code
  • Terminal
  • Ubuntu Version 20.04.3-desktop

Team / Contributors / Teachers

How to Set Up

This project was implemented on our local machine inside of a virtual machine using:

  • Ubuntu Version 20.04.03 found at this link.
  • Clone this repository
  • Open terminal at the codebase ~.../ext2-file-system/Noah-Mitchell/
  • Run our mk file which creates a new disk image, and then start up the file system with that new disk image mounted. Use this command:
./mk
  • The Ext2 File System will begin running in your terminal.

Commands Implemented

Symbol Meaning
Implemented
☑️ Partially Implemented
Not Implemented

Level 1

Implements the file system. The structure is described on page 318 of the Systems Programming Book. Also as a reference, the figure is below:

Tree Structure

Command Implemented? Description
cd Changes the directory from the current working directory to the new path.
ls Lists information about the FILEs (only works for the current directory).
pwd Prints the full filename of the current working directory.
mkdir Creates a DIRECTORY, if they do not already exist.
rmdir Removes the specified DIRECTORY, if its empty.
creat Creates a FILE, if it does not already exist.
show Prints the inode number, record length, name length, and name of each file item in the current working directory.
hits Prints the cacheList and hit_ratio percentage.
link ☑️ Creates a hard link to an existing file. (Bug: only works on files added when the disk image is created and not for any files created while running)
unlink ☑️ Removes the hard link by decreasing the link count of the specified file. (Bug: only works on files added when the disk image is created and not for any files created while running)
symlink ☑️ Creates a symbolic link that can link to DIRs and files not on the same device. (Bug: only works on files added when the disk image is created and not for any files created while running)
exit Closes the file system process and all active file descriptors if any.

Level 2

Focuses on read and write operations of files

Command Implemented? Description
open Opens a file descriptor for the specified file.
pfd Prints the terminal all the opened file descriptors.
close Closes a file descriptor for the specified file.
lseek Repositions the offset of the file descriptor to the new position.
read Reads nbytes from an opened file descriptor into a buffer area in user space.
write ☑️ Writes nbytes from a buffer area in user space to an opened file descriptor and returns the actual number of bytes written. (Bug: Output is not saved once command completes)
cat ☑️ Prints out the contents of the specified file until EOF is reached. (Bug: Segmenation fault for files with contents larger than 1024 bytes)
head ☑️ Prints out the FIRST 10 lines of a file to the terminal. (Bug: Inconsistent output depending on what file is selected)
tail ☑️ Prints out the LAST 10 lines of a file to the terminal. (Bug: Inconsistent output depending on what file is selected)
cp Writes the contents of an existing file to a new area on the disk image, creating a duplicate of the file.
mv Moves the file to a new space on current disk image or a new device entirely by creating a hard link or using the cp command if it's not the same dev.

Acknowledgments

This codebase and all supporting materials was made as apart of a course for my undergrad at WSU for CPTS 360 - Systems Programming C/C++ in the Spring of 2023. This project was originally submitted to a private repository as all WSU assignments are, that has forking disabled. This repository serves as a backup place to showcase this project. The original repo is linked here.

About

A Linux Compatible Ext2 File System that creates its own disk on startup or uses existing disks and can preform common linux commands like ls, cd, pwd, mkdir, rmdir, read, write, open, link, symlink, and etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published