CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 1 of 7 · 2 min read

Why this page comes sixth

In this module you will

  • Explain how mounting joins several file systems into one directory tree, and what a mount point hides.
  • Explain the virtual file system layer and its table of operations, and write a small version in C.
  • Tell a disk file system from proc, sysfs, tmpfs and devtmpfs, and say where each one gets its data.
  • Read a mount table and a mount option, and tell when a path crosses into another file system.
  • Name what a bind mount does, and what changes when a directory is mounted over.

Pages 1 to 5 looked at one file system on one device. A real machine has many: the root, a data disk, memory-backed directories, the /proc tree that Level 0 used, and network shares. A program still uses the same calls, open, read and write, on all of them. This page shows how the kernel makes that possible. It connects the I/O layers of Level 8, page 5 to the file system code of this level, and it prepares Level 11 where a container gets its own view of the mounts.

About this example About this example

Real: The program of section 3 was compiled with gcc -Wall -Wextra and run on a Linux test machine (kernel 6.18). The ext4 image of 16 MiB was mounted through a loop device, and a 1 MiB tmpfs was mounted on a directory inside it. The listings of device numbers, types and sizes are the program's output. The mount line of section 5 was read from /proc/mounts on the same machine.

Scripted: The miniature VFS of section 2 is written for this page. Its file systems, memfs, zerofs and clockfs, and the strings they return are made up to show the idea.

Not real: The real Linux VFS has four kinds of objects (superblock, inode, dentry and file), many more operations, caches and locks. The test machine is a virtual machine, so its root device and the /dev entries are those of a guest.