Skip to content

About

🗂️ FCT NOVA · Operating Systems Fundamentals (FSO), 2024/25: a small UNIX-like file system in C on a simulated disk — superblock, bitmap, inodes, directories, path resolution, open/close/read.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

🗂️ File System — Operating Systems Fundamentals

C Course Year

Mini-project of Fundamentos de Sistemas de Operação (Operating Systems Fundamentals), Computer Science degree at NOVA School of Science and Technology (FCT NOVA).

About

A small UNIX-like file system stored on a simulated disk (a regular file split into 2 KB blocks). The disk has a superblock, a bitmap of free blocks, an inode table and data blocks holding file contents and directories. A shell (fso-sh) lets you explore a disk image.

The course provided the disk driver, the bitmap, the shell and the on-disk structures. Our job was to complete the file system in fs.c:

  • Path resolution — walk directories from the root inode to find the inode of a path like /dir1/file2
  • ls — list a directory's entries with their inode number, type and size
  • open, close and read — an open-file table and reading a file's contents through its 11 direct block indexes and one indirect index block

Running it

Needs a C compiler and make (Linux or macOS).

make
./fso-sh small.dsk
fso-sh> ls
listing dir / (inode 0):
ino:type bytes name
  1:D      128 dir1
  2:F      530 file1
  5:F     5562 file2
fso-sh> ls /dir1
listing dir /dir1 (inode 1):
ino:type bytes name
  3:D        0 dir1.1
  4:F      273 file2
fso-sh> copyout /file2 file2.txt
fso-sh> debug        ← superblock, block bitmap and inodes in use
fso-sh> exit

Other commands: cat <path>, help.

What I learned

  • How a file system lays out its data on disk: superblock, free-block bitmap, inodes and directory entries
  • Mapping a byte offset in a file to a disk block through direct and indirect indexes
  • Low-level C: packed structures, raw block I/O and careful buffer handling

Credits

fso-sh.c, disk.c/disk.h, bitmap.c/bitmap.h, fs.h, the Makefile and the small.dsk disk image were provided by the FSO teaching staff; fs.c was completed by us.


The assignment statement is not included in this repository, as it belongs to the course's teaching staff. This is a student project shared for portfolio purposes.

About

🗂️ FCT NOVA · Operating Systems Fundamentals (FSO), 2024/25: a small UNIX-like file system in C on a simulated disk — superblock, bitmap, inodes, directories, path resolution, open/close/read.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages