tmpfs: files in memory
A tmpfs is a filesystem whose contents live in the kernel page cache and swap, not on a block device. Files you create there are fast to read and write, and they disappear at unmount or at shutdown. The directory /tmp is commonly a tmpfs for this reason: scratch files do not need to survive a reboot, and they should not leave debris on the disk.
A tmpfs has a size limit, which defaults to a fraction of physical memory. Writing past the limit fails with "No space left on device" even if the underlying system has free memory elsewhere. The size is a property of the mount, not of the files, and the kernel enforces it on every write.
awk '$2 == "/tmp" { print $1, $3 }' /proc/mountsThe source of a tmpfs is the word tmpfs, because there is no device behind it. In the lab, /tmp is a tmpfs, and that is why anything you put there vanishes when you reload the page. Use /workspace for files you want to keep for the rest of the session.
Choosing tmpfs has real trade-offs. Because the data lives in RAM and swap, heavy writes can push the system into memory pressure, and the kernel may move pages to swap, which is slower than RAM but often faster than a disk. A tmpfs is therefore well suited to scratch space, temporary build output, and lock files. It is a poor place for a database or a long download that you cannot afford to lose.
The same reasoning explains why a tmpfs has permissions and a size limit but no journal. There is no disk to protect and no crash to recover from, so the filesystem does not carry the structures that a disk filesystem needs to survive a power loss.
Overlay: stacking layers
An overlay filesystem merges several directory trees into one view. It has a set of lower layers, which are read-only, and one upper layer, which is writable. A lookup finds a file in the upper layer first and then the lower layers. A write to a file that exists only in a lower layer first copies the file up into the upper layer, and then the write happens there. The lower layer is never changed.
Deletion works through whiteouts. When you delete a file that exists in a lower layer, the overlay cannot remove it from that read-only layer, so it records a special marker in the upper layer that hides the lower file. The file still exists in the lower layer. It is merely invisible through the merged view.
This model is why container images are cheap. Many containers share the same read-only image layers, and each container adds its own small writable layer. The overlay merges them into a single root. The Linux kernel documentation describes the exact rules, and the lesson links to it below.
Finding the overlay in the lab
The root of this lab is an overlay. You can see the source, the type, and the options with one command. The options name the lower directories and the upper directory, which is the detail that shows the layering.
findmnt -n -o SOURCE,FSTYPE / | cut -c1-70The type is overlay. The full options list is long, because it names several directories, but its first part reads like a list of lower and upper paths. You do not need to memorize those paths. What matters is the principle: reads come through the stack, writes land in the upper layer, and the lower layers stay fixed.
A lower layer on this machine is a read-only disk image, so the files that came with the system cannot be edited in place. Writes to them land in a writable layer above, and that layer lives in memory. A reload of the lab page returns the root to its starting state.
Writing in a layered tree
Files that come with the system live in the lower layer, and your user cannot change them. Writes to new paths always land in the writable layer. A file you create in /workspace therefore lives in the upper layer from the first byte, and the demonstration below uses such a file. The copy-up rule still applies to any lower file that a process with the right permissions edits, because the overlay copies the file up before the first write.
echo hello > notes.txt
findmnt -n -o FSTYPE -T notes.txtThe second command reports overlay, because the file lives in the merged root. Reading the same information from the mount table gives the same answer, and that is the point: the path tells you nothing about the layer, but the mount does.
Why this matters when you debug
Knowing the layering changes how you investigate a problem. If a file is "missing" after an update, the upper layer may hide a lower file through a whiteout. If a change disappears after a reboot, you were probably writing to a tmpfs or to the upper layer of a stateless system. If a write fails on a read-only disk, look at the lower layer, not at the permissions of the file.
Hands-on: classify the mounts
Build a short report that lists each mount point with its type for the two kinds of filesystem in this lesson. The report separates the durable overlay root from the memory-backed tmpfs, so you can see which paths will survive a reload.
awk '$3 == "tmpfs" || $3 == "overlay" { print $2, $3 }' /proc/mountsThe output lists / with overlay and /tmp with tmpfs, and it may list more tmpfs mounts. Read each line and ask whether the data behind it would survive a reload. That question is the practical test for any mount you meet.