What Is a Filesystem in Simple Terms
Imagine a massive library. The books are your data. The filesystem is the cataloguing system — the rules for how books are labelled, where they go on shelves, and how you find them again. Without it, every piece of data would be indistinguishable from every other.
A filesystem answers three fundamental questions: where is the data stored on disk, what is it called, and who is allowed to access it.
How It Works
Linux sits a Virtual File System (VFS) layer between the kernel and actual storage. VFS provides a single consistent interface for all filesystem types. Applications call open(), read(), write() — they never need to know whether the data is on ext4, XFS, NFS, or a kernel virtual filesystem.
Application (nginx, postgres, node)|vVFS (Virtual File System) -- unified interface|+----+----+----+----+| | | | |v v v v vext4 xfs nfs proc sys(disk filesystem) (virtual)Common Linux filesystems:
ext4 Most common for system partitions Journaling, good performance, backward compatible XFS High-performance, large file handling Default on RHEL/CentOS, Amazon Linux Better for large files and parallel I/O tmpfs RAM-backed filesystem /tmp and /run are usually tmpfs Fast but cleared on reboot /proc Virtual — kernel process and system info/sys Virtual — kernel hardware interface/dev Virtual — device file representation NFS Network filesystem — remote storage over networkextended (ZFS, Btrfs) Advanced features but less commonMounting — attaching a filesystem:
Linux has one directory tree starting at /. Every filesystem must be mounted at a mount point — a directory in that tree — before its files are accessible.
## Show all mounted filesystemsdf -h## Filesystem Size Used Avail Use% Mounted on## /dev/xvda1 20G 12G 7.5G 62% /## tmpfs 1.9G 1.2M 1.9G 1% /tmp## /dev/xvdb1 100G 45G 55G 45% /data ## Show filesystem typedf -Th## Filesystem Type Size Used Avail Use% Mounted on## /dev/xvda1 ext4 20G 12G 7.5G 62% /## tmpfs tmpfs 1.9G 1.2M 1.9G 1% /tmp ## Mount a device manuallysudo mount /dev/sdb1 /mnt/data ## Unmountsudo umount /mnt/dataPersistent mounts in /etc/fstab:
## /etc/fstab format:## device mountpoint fstype options dump pass/dev/xvda1 / ext4 defaults 0 1/dev/xvdb1 /data xfs defaults,noatime 0 2tmpfs /tmp tmpfs defaults,size=2G 0 0Checking and repairing filesystems:
## Check filesystem health (must be unmounted or read-only)sudo fsck -n /dev/sdb1 ## -n = dry run, check only ## Force check on next rebootsudo touch /forcefsck ## Show inode usage (can fill up before disk space runs out)df -i## Filesystem Inodes IUsed IFree IUse% Mounted on## /dev/xvda1 1310720 45231 1265489 4% /Practical Commands
## Check disk space across all filesystemsdf -h ## Check inode usage (separate from disk space)df -i ## Show filesystem typedf -Th ## Find filesystem type of a specific pathstat -f /var/log/ ## Check what filesystem type a device usesfile -sL /dev/xvda1 ## List block devices and their filesystemslsblk -fTroubleshooting
| Symptom | Command | What to Look For |
|---|---|---|
| Disk full errors | df -h |
Filesystem at 100% Use% |
| Cannot create files despite disk space | df -i |
Inode count at 100% IUse% |
| Filesystem read-only unexpectedly | `dmesg | grep error` |
| Mount point missing after reboot | cat /etc/fstab |
Mount entry missing or wrong device name |
PLACEMENT PRO TIP**Tip:** A filesystem can be completely full of inodes even when disk space is available. This happens with directories containing millions of small files (like email spools or build caches). Always check `df -i` alongside `df -h`.
REMEMBER THIS**Remember:** `/proc`, `/sys`, and `/dev` are not real filesystems. They have no files on disk. The kernel generates their contents in memory. You cannot run out of disk space from files in these directories.