# Storage and Filesystems ## Block devices and partitions, conceptually A **block device** is the kernel's view of a storage device (a disk, an SSD, a cloud volume) — `lsblk` lists them. A device can be split into **partitions**, separate sections each formatted with their own filesystem, though a single-partition disk is common too. You won't partition anything in this Lab, but recognizing `lsblk`'s output (`sda`, `sda1`, `nvme0n1`...) matters for reading real systems. ## Filesystems and mount points A **filesystem** is the format that organizes raw blocks into the files/directories you actually interact with (ext4, xfs, and — inside this container — overlay, a filesystem UNIQUE to how containers layer their storage). A filesystem becomes usable by being **mounted** at some directory path — `/` itself is a mount point, and additional filesystems can be mounted at other paths (a separate disk mounted at `/data`, for example). ## Persistent vs. temporary storage — a distinction that matters immediately Not everything written to disk is meant to last. `/tmp` is conventionally temporary (ROOT 01); a container's own writable layer is, by convention and by ROOT 04's design, meant to be DISPOSABLE — data written inside a container that isn't explicitly persisted elsewhere disappears when that container is destroyed. This distinction — is this data supposed to survive, or not — is the single most important storage question you'll carry forward into ROOT 04's volumes and eventually Kubernetes' PersistentVolumes. ## Measuring usage: `df` vs. `du` These answer two DIFFERENT questions, a common point of confusion: - **`df -h`** — how much space is used/free on an entire mounted FILESYSTEM. - **`du -sh `** — how much space one specific DIRECTORY's contents actually use. A filesystem can show plenty of free space overall (`df`) while one specific directory has unexpectedly ballooned (`du`) — you need both questions answered to diagnose "why is disk full." ## Instructor Notes **Lesson goal:** Build the persistent-vs-temporary distinction explicitly, since it's the direct conceptual root of ROOT 04's bind-mount/volume distinction and, later, Kubernetes storage. **Approximate timing:** 12 minutes read; 8 minutes live. **Common misconception to watch for:** conflating `df` and `du` — a student surprised that `df` doesn't show them "which directory is huge" is a good moment to reinforce they answer different questions. **Demo idea:** `df -h /` then `du -sh /var/log/*` side by side, narrating the different question each answers.