Houjun Liu

filesystem

The filesystem is the only thing that can store anything across power offs.

disk

Unlike memory, its “sector-addressable”: you cannot read or write individual bytes. The disk is divided into sectors, which you have to wholesale read and write.

seeking

Because disks are mostly moving, reading and writing requires seeking: to wait until the platter go under the arm and read.

filesystems are designed to minimize the seek time.

functionality

  • creating
  • looknig up
  • reading: sequential + random file access; access either all of a file or a part of the file
  • editing
  • creating folders

main challenges

  • disk space management: minimize seeks, sharing space, efficient use of disk
  • naming: how do users name files
  • reliability: surviving OS crashes and hardware failures
  • protection: isolation between users, controlled sharing

block

a block is a group of one or more sectors, which issued to abstract away chunks of sectors.

fragmentation

internal fragmentation

A file can be no less than a single block of text.

external fragmentation

“no space is available even if the space in aggregate is available”

models of storage

We typically put two things into the block:

  • file payload data
  • file meta-data

there is a few ways to do this: