Facebook Pixel

File Systems & Storage Overview

Up until now, we have focused heavily on Main Memory (RAM). But RAM has a fatal flaw: it is volatile. The moment the power button is held down or the battery dies, everything in RAM vanishes instantly.

For a computer to be useful, it needs a way to store data permanently. It relies on non-volatile Secondary Storage, like Hard Disk Drives (HDDs) or Solid State Drives (SSDs). But raw storage hardware is just a massive, unstructured expanse of billions of empty blocks. The Operating System needs a way to organize this chaos.

What is a File System?

A File System is the software component of the Operating System responsible for organizing, storing, and retrieving data on a storage device.

It acts as a translator. As a user, you think in terms of logical objects: "I want to open my vacation photo" or "I want to save my text document in the Work folder". The storage hardware, however, only understands physical reality: "Write this stream of 1s and 0s to Block 4592 on Platter 2".

The file system bridges this gap, completely hiding the immense complexity of the hardware from both the user and the software applications.

Without a File System...
...information placed on a storage drive would be one giant, continuous body of raw data. There would be absolutely no way to tell where one piece of information stops and the next piece begins. Finding a specific document would be impossible.

The Two Core Abstractions

1. The File

The OS abstracts the physical properties of storage devices into a single logical storage unit: the File. A file is simply a named collection of related information recorded on secondary storage. Every file has two parts:

  • Data: The actual content itself (the text of an essay, the pixels of a photo, the compiled code of a program).
  • Metadata (Attributes): Information *about* the file. The OS attaches a hidden data block to every file that stores its Name, Unique Identifier, File Type, Exact Location on the disk, Size, Creation/Modification timestamps, and Owner permissions.

2. The Directory

A directory (commonly called a folder) is a mechanism for organizing files. Under the hood, a directory is actually just a special type of file whose "Data" is a list of other files and subdirectories.

Directories allow the OS to create a hierarchical tree structure. This makes it possible for a modern system to hold millions of files without naming collisions, as long as two files with the same name are placed in different directories.

Key Responsibilities of the File System

The file system is responsible for several critical background tasks:

  • Space Allocation: When you save a new file, the file system must search the disk, find available empty blocks, and decide exactly which physical sectors should hold the file's data.
  • Free Space Management: The OS maintains detailed records (like a bit vector or linked list) of which blocks are empty, which are full, and which are corrupted/broken.
  • Access Control & Security: The file system enforces security rules, tracking Read (R), Write (W), and Execute (X) permissions to ensure one user cannot delete or view another user's private files.
  • Reliability & Journaling: If a laptop crashes due to a power failure exactly in the middle of saving a file, the file system must ensure the disk doesn't become permanently corrupted. Modern systems use "Journaling" to record intent before writing, allowing them to recover gracefully from crashes.

The Storage Hierarchy

Computer storage is always a trade-off between Speed, Capacity, Cost, and Volatility. Data moves up and down this hierarchy as it is needed.

Storage LevelExamplesCharacteristics
Primary StorageCPU Registers, L1/L2/L3 Cache, Main Memory (RAM)Volatile (loses data without power). Ultra-fast. Very expensive per gigabyte. Low capacity.
Secondary StorageSolid State Drives (SSD), Hard Disk Drives (HDD)Non-Volatile (permanent). Slower access times. Cheaper per gigabyte. High capacity.
Tertiary StorageMagnetic Tape, Optical Disks (Blu-ray, DVD)Non-Volatile. Extremely slow (requires robotic arms or manual loading). Incredibly cheap. Massive capacity used for long-term archival backups.

Summary

The File System is arguably the most visible part of the Operating System to the end user. While memory management and CPU scheduling happen invisibly in the background, the file system provides the persistent interface we interact with every single day when we click on folders, download images, or launch applications.

Sort the Concepts

Classify the following storage components based on their volatility (whether they retain data when power is lost).

Volatile Storage
Non-Volatile Storage
Unsorted Items:
Main Memory (RAM)
Solid State Drive (SSD)
CPU L2 Cache
Magnetic Hard Disk Drive (HDD)
Magnetic Archival Tape
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.