How a file system is organised

Blocks, superblock, inode table and data blocks, the three allocation schemes (contiguous, chained through a FAT, indexed), the directory as a file, fragmentation and journaling.

  • 25 cards
  • 4 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Concepts
  2. Questions
  3. Sort and link
  4. The numbers

A few cards from the deck

  • Block: what is it?

    Show the answer

    The smallest unit the file system reads or writes on disk, a few kilobytes (4 KiB most often), which holds part of a file.

    A 1-byte file takes a whole block. The waste in each file's last block is called internal fragmentation.

  • A FAT holds (block: next) 4: 7, 7: 2, 2: 11, 11: END, 5: 6, 6: END. In what order are the blocks read for the file whose directory entry gives block 4?

    • 4, 7, 2, 11
    • 2, 4, 7, 11
    • 4, 5, 6, 7
    • 11, 2, 7, 4
    Show the answer

    4, 7, 2, 11

    Start at block 4 and read entry 4: it gives 7; entry 7 gives 2; entry 2 gives 11; entry 11 holds the end mark. Blocks 5 and 6 form another file; the order of the numbers has no bearing on the file's order.

  • A directory is itself a … whose content is a list of pairs: a name and an … number.

    Show the answer

    A directory is itself a file whose content is a list of pairs: a name and an inode number.

    Opening a path amounts to reading directories one after another: each supplies the next one's inode. This is also why renaming a file leaves its data blocks untouched.

  • Superblock: what is it?

    Show the answer

    A block at a known place on the disk that describes the file system: block size, number of inodes and blocks, location of the tables, number of free blocks.

    Without it, the kernel could not read the rest; it is the first thing read at mount time. Systems keep copies of it to survive its loss.