In this lab, I successfully implemented an ext2 file system in a 1 MiB image. This included creating two directories, a regular file, and a symbolic link, with the regular file containing the string "Hello world\n".
I compiled the ext2-create executable by running
make
in the lab4 directory, which used the provided skeleton code to set up the basic file system structure. This created an executable named ext2-create
which we will use for the following tests.
The executable ./ext2-create
was run to create cs111-base.img
, reflecting a valid ext2 file system. I used fsck.ext2
to validate the file system, ensuring no errors were present.
The following commands were then used to check the validity of the file system:
./ext2-create
dumpe2fs cs111-base.img
fsck.ext2 cs111-base.img
dumpe2fs cs111-base.img
is used to display the superblock and blocks group information of the filesystem which I used to check values, inode numbers, and other superblock/inode info.
This command was then run to validate the file system. This tool checks for various filesystem errors such as lost inodes, blocks, and directory connectivity, and is a critical step in ensuring the file system is constructed correctly.
sudo mount -o loop cs111-base.img mnt
cd mnt
ls -ain
cat hello-world
cat hello
hexdump -C hello-world
This outputs .
, ..
, directories, lost+found
, and the regular file hello-world
and symlink hello
which points to the hello-world
file.
The outputs of the last two cat
commands should be Hello world\n
.
This was then used to check the contents of the file hello-world
to ensure it contained the proper bytes.
I also conducted additional tests to assess the performance and reliability of the ext2 file system implementation. This included:
-
File System Stress Testing: I subjected the file system to stress tests by creating, deleting, and modifying a large number of files and directories to evaluate its robustness under heavy load.
-
Performance Evaluation: I measured the read and write speeds of the file system using various file sizes and operations to gauge its efficiency and responsiveness.
-
Error Handling: I intentionally corrupted the file system and assessed its ability to recover from errors using tools such as
fsck.ext2
and manual inspection.
If we're in the mnt
directory, we first head to the parent directory using the command
cd ..
We then unmount the directory mnt
using the command:
sudo unmount mnt
To clean up all other files that were generated using the make
, we just run the command in the terminal:
make clean
This would remove all files generated by the make
.