Lecture 21 - Minix Filesystem Structure, Finishing Virtual Memory

A filesystem is just a data structure that organizes files, which is just a collection of stuff. It has:

Minix Filesystem

Note that assignment 5 is the largest assignment of the class; however, all the code is yours and it is pretty simple.

The basic structure is that you have:

An Aside on Disks

Every disk side have a track. Each track is grouped into cylinders, and there are multiple heads for choosing each cylinder. As such then we can think of turning our disk into an array of slots of bytes we can store at.

For partitioning, we may have multiple partitions on one disk. MINIX allows for sub-partitioning! For the partition table in the Master-Boot-Record (MBR) has 4 entries:

But in reality there are more cylinders than sectos, so usually the cylinder part gets like 10 bits while the sector gets like 6 bits.

Now how can we verify that our data is actually valid on the disk (rather than being garbage data). We use the:

Here to clarify the filesystem's blocks:

But look! The super-block is the second block! We say that the super-block must start at the start of a page, at a pre-specified offset from the boot block.

In Action

Let's say we want to look for /A/B/C. For convenience we say inode 1 is the root of our file system (since inode 0 is used for marking files for deletion, and thus our inode's are 1-indexed).

Now this inode we get and it has a size (see above). That means that we can use the zone number and from that get zone information via the data for the / directory.

/
- 1: .
- 1: ..
- 2: usr
- 10: home
- 12: A

We see that the next zone number is 12 so we go to that zone and get that file's contents:

/A
- 12: .
- 1: ..
- 0: bogus
- 7: foo
- 123: B

So then we know the next zone number is 123 so we go to that zone number and get that file's contents:

/A/B
- 123: .
- 12:  ..
- 100: C

So the idea is to: