15 min read Beginner to Intermediate Lesson 11 (of 30)
Part 2 — Electricity & Digital Logic

How Storage Works: From HDD to SSD and NAND Flash

Data in RAM vanishes the instant power cuts off. Yet your photos, videos, operating system, and personal files remain safely preserved for years. How do physical drives store 0 and 1 permanently without electricity?

Where Do Bits Physically Reside on a Drive?

Even under an electron microscope, you won't find the numbers '0' or '1' stamped onto storage media.

In an HDD, bits are encoded as Magnetic Domain Polarities on spinning platters. In an SSD, bits are Trapped Electrical Charges inside microscopic silicon flash cells. Controllers interpret these physical phenomena as digital data.

1–3. RAM vs. Storage (Volatile vs. Non-Volatile)

⚡ RAM (Volatile Memory)

The computer's Working Memory. Lightning fast, but requires continuous power—data dissolves immediately when de-energized.

💾 Storage (Non-Volatile)

The computer's Persistent Storage. Retains files, applications, and operating systems across reboots and decades without power.

Storage (SSD/HDD - Permanent) → RAM (Memory - Active Working) → CPU / GPU (Compute - Execution)

4–8. HDD (Hard Disk Drive): Magnetic Mechanical Storage

For over half a century, Hard Disk Drives (HDDs) formed the bedrock of digital computing. Inside, precision electric spindle motors spin metallic or glass platters coated with microscopic magnetic thin-film coatings.

Core Components and Mechanics of an HDD:
  • 💿 Magnetic Platters: Spin rapidly at 5,400 to 7,200 Revolutions Per Minute (RPM).
  • 🔬 Read/Write Heads: Fly nanometers above platter surfaces, magnetizing microscopic domains (North/South magnetic poles represent 0 and 1).
  • ⏱️ Mechanical Seek Latency: Moving physical actuator arms to target tracks takes milliseconds (Seek Time), making random reads comparatively slow.
Read/Write Head ──(Magnetic Field)──→ Platter (Spinning Disk) ──→ 0 / 1 Bit Decode

9–15. SSD and NAND Flash Memory

Solid-State Drives (SSDs) have no spinning platters or mechanical actuator arms. They are built entirely from solid-state semiconductor NAND Flash memory chips.

NAND Flash Cells & Charge-Trap Technology

Flash cells trap electrons within microscopic floating gates or charge-trap silicon layers. Trapped electrons alter the transistor's electrical threshold voltage, which can be read to detect stored bit values.

SLC
1 bit / cell
Fastest & Highest Endurance
MLC
2 bits / cell
4 voltage threshold levels
TLC
3 bits / cell
8 levels (Most common consumer)
QLC
4 bits / cell
16 levels (Highest density)

16–23. The SSD Controller: The Unsung Mastermind

An SSD is much more than passive flash chips. Its heart is the SSD Controller—a dedicated embedded multi-core processor running sophisticated firmware.

The Page and Block Constraint

NAND flash reads and writes in Pages (e.g. 4KB to 16KB). However, flash cannot overwrite in place: it must erase an entire Block (consisting of hundreds of pages) at once.

Wear Leveling Algorithms

Silicon oxide layers degrade after repeated program/erase cycles. The controller evenly distributes write operations across all flash blocks to maximize drive longevity.

Garbage Collection & TRIM

The OS sends TRIM commands identifying deleted data. In the background, Garbage Collection consolidates valid pages and erases stale blocks so future writes are fast.

ECC (Error Correction Codes)

LDPC (Low-Density Parity-Check) algorithms detect and mathematically correct bit-flip errors caused by electrical noise and charge leakage.

25–26. SATA vs. NVMe (PCIe)

SATA SSD

Legacy storage interface; throughput capped at ~500 to 550 MB/s.

NVMe SSD (PCIe Gen 4/5)

Communicates directly over PCIe lanes; speeds reach 3,500 to 14,000+ MB/s!

30. HDD vs. SSD: Direct Head-to-Head Comparison

Feature HDD (Hard Disk Drive) SSD (Solid-State Drive)
Storage Medium Magnetic Platters NAND Flash Semiconductors
Moving Parts Yes (Spindle motor & heads) None (Completely silent)
Access Latency Slow (10 to 15 milliseconds) Ultra-fast (Microseconds)
Shock Resistance Vulnerable to drops & vibration Highly durable and shockproof
Cost per Gigabyte Very low (Ideal for bulk cold storage) Higher (Though steadily dropping)

33–35. The End-to-End Journey of Saving and Opening a File

User writes text → Encoding (ASCII/UTF-8) → Bits (0/1) → File System (NTFS/ext4) → Storage Driver → NVMe Controller → NAND Flash Cells (Electrical Charge Trapped)

42. The Master Abstraction Hierarchy of Modern Storage

User View photo.jpg
File System Logical Blocks & Paths
SSD Controller Flash Translation Layer (FTL)
Physical Hardware Trapped Electron Charges

🧠 Key Takeaways

  • Persistent Storage: Preserves data in non-volatile media indefinitely without requiring active electrical power.
  • HDD: Encodes bits using magnetic polarities on high-speed spinning platters.
  • SSD & NAND Flash: Encodes bits by trapping electrons inside microscopic semiconductor floating gates or charge traps.
  • SLC/MLC/TLC/QLC: Represents how many bits are stored per physical flash cell.
  • SSD Controller: Manages Wear Leveling, Garbage Collection, TRIM, and ECC to preserve data integrity and drive health.
  • NVMe: Connects directly over high-speed PCIe lanes to move data at thousands of megabytes per second.
🚀 Next Lesson

Lesson 12 — What is an Operating System? The Bridge from Hardware to Software

Explore how the kernel, processes, threads, virtual memory, and system calls effortlessly manage millions of lines of software on physical silicon.