0 day streak
5. Operating systemsFile systems

File systems

A file system is the part of the operating system that turns a raw disk, which only knows numbered blocks, into named files and folders. On Unix-like systems each file is described by an inode, a record of its size, permissions and where its data blocks are, and a directory is just a list mapping names to inodes, which is how one file can have several names. Writes usually land in an in-memory page cache and reach the disk later, which is fast but means a crash can lose recent changes. Calling fsync forces data onto durable storage, and journaling keeps the structure consistent after a crash. Databases are built on exactly these guarantees.

In this lesson: An inode explorer. The write path flows through the page cache to disk with an fsync button. Break-it: crash and see what was lost.