Overview of Unix Filesystems

Key Question

How can we design filesystems to store and manipulate files on disk, and how can we interact with the filesystem in our programs?

../_images/filesystem-inode-design.png
  • Unix and C libraries for file manipulation: stat, struct stat, open, close, read, write, readdir, struct dirent, file descriptors, regular files, directories, soft and hard links, programmatic manipulation of them, implementation of ls, cp, cat, etc.

  • Naming, abstraction and layering concepts in systems as a means for managing complexity, blocks, inodes, inode pointer structure, inode as abstraction over blocks, direct blocks, indirect blocks, doubly indirect blocks, design and implementation of a file system.

  • Additional systems examples that rely on naming, abstraction, modularity, and layering, including DNS, TCP/IP, network packets, databases, HTTP, REST, descriptors and pids.

  • Building modular systems with simultaneous goals of simplicity of implementation, fault tolerance, and flexibility of interactions.

Lectures

  • Filesystem Design

    • Learning Goals:

      • Learn about the differences in how data is stored in memory vs. on disk

      • Understand the design of the Unix v6 filesystem in how it represents files

      • Learn how to use indirect blocks to support even larger files

      • Understand the design of the Unix v6 filesystem in how it represents directories

      • Practice with the full process of going from file path to file data

      • Understand the tradeoffs and limitations in filesystem design

    • Readings:

      • S & K Chapter 2

  • Filesystem System Call

    • Learning Goals:

      • Learn about the open, close, read and write functions that let us interact with files

      • Get familiar writing programs that read, write and create files

      • Learn what the operating system manages for us so that we can interact with files

      • Understand the use and versatility of file descriptors

      • Learn how file descriptors are used by the operating system to manage open files

      • Learn how system calls are made while preserving privacy and security

      • Become familiar with how to write a program that spawns another program

    • Readings:

      • Bryant & O’Hallaron, Chapters 10 and 8.

Labs

  • Lab 01: File Systems and System Calls

Assignments

  • Assignment 1: Six Degrees of Kevin Bacon

  • Assignment 2: Reading Unix V6 Filesystems