Linux Filesystem
The Filesystem Hierarchy Standard, mount points, filesystem types (ext4, xfs, tmpfs), and how storage devices become directories.
What Is the Linux Filesystem?
Unlike Windows (C:\, D:\), Linux has one unified tree rooted at /. Every disk, partition, network share, or virtual filesystem gets mounted onto a directory within that single tree — there’s no concept of separate drive letters.
The Filesystem Hierarchy Standard (FHS)
| Path | Purpose |
|---|---|
/etc | System-wide configuration files (never binaries) |
/var | Variable data: logs (/var/log), spool, databases |
/usr | User-installed programs and libraries (most of the OS actually lives here) |
/home | Per-user home directories |
/tmp | Temporary files, cleared on reboot (often tmpfs, i.e., RAM) |
/opt | Third-party/optional software packages |
/proc, /sys | Virtual filesystems exposing kernel/process state — not real files on disk |
/dev | Device files (/dev/sda, /dev/null, /dev/tty) |
Mounting: Turning a Device Into a Directory
# List all mounted filesystems
mount
df -hT
# Mount a device manually
sudo mount /dev/sdb1 /mnt/data
# Persist mounts across reboot
cat /etc/fstab
# UUID=xxxx /mnt/data ext4 defaults 0 2
# See disk usage per directory
du -sh /var/log/*
/etc/fstab is read at boot to automatically mount everything — a wrong entry there is one of the classic ways servers fail to boot (“emergency mode”).
Common Filesystem Types
| Type | Notes |
|---|---|
ext4 | Most common general-purpose Linux filesystem; journaled, mature, reliable |
xfs | Default on RHEL/CentOS; excels with large files and high parallelism |
tmpfs | RAM-backed, volatile — used for /tmp and /dev/shm for speed |
overlayfs | Union filesystem — this is how Docker layers images |
nfs | Network File System — mount a remote directory as if local |
# Check filesystem type of a mount
findmnt -T /var
lsblk -f
Everything Is a File
A defining Unix/Linux philosophy: devices, pipes, sockets, and even kernel data structures are exposed as files.
cat /proc/cpuinfo # CPU info, read from a "virtual" file
cat /proc/meminfo # Memory info
echo hello > /dev/null # Discards output — /dev/null is a real device file
cat /proc/1/status # Info about PID 1 (init/systemd)
Production Considerations
- A full
/var(usually from runaway logs) is one of the most common causes of production outages — monitor disk usage on/var/logspecifically. /tmpastmpfsmeans anything written there is lost on reboot and counts against RAM — don’t put large persistent files there.- Always use UUIDs (not
/dev/sdXnames) in/etc/fstab— device names can shift between boots, especially with multiple disks.
Quick Interview Answer
“Linux uses a single unified directory tree rooted at
/, with disks and partitions mounted onto directories rather than given drive letters. The Filesystem Hierarchy Standard defines conventions —/etcfor config,/varfor logs,/usrfor installed software./procand/sysare virtual filesystems exposing live kernel state, not real files on disk.”
Common Mistakes
- Storing application data in
/tmpand being surprised it disappears after a reboot. - Referencing
/dev/sdb1directly in/etc/fstabinstead of its UUID. - Not monitoring
/var/logdisk usage until the disk is already full and services start failing to write.
Add More Questions to This Guide
Know a question that should be here? Share it and help the community!
Open Google Form