Filesystem
A filesystem is the structure an operating system uses to name, store, and retrieve files on a storage device. Linux commonly uses ext4 and XFS on disk, plus virtual filesystems such as /proc and /sys that live in memory.
Understanding Linux Filesystems
What Is a Filesystem in Linux?
A filesystem answers three questions: where data lives on disk, what it is called, and who may access it. Linux presents all storage as one directory tree starting at /, and each filesystem is attached to that tree at a mount point.
How the Virtual File System Layer Works
Between applications and storage sits the Virtual File System (VFS). Programs call open(), read(), and write() without knowing whether the data is on ext4, XFS, NFS, or generated by the kernel.
Common Linux Filesystems
ext4 Default on many distributions; journaling, mature, general purposeXFS Strong with large files and parallel I/O; default on RHEL and Amazon LinuxBtrfs Snapshots and checksums; used on some distributionsZFS Advanced features; usually installed separatelytmpfs RAM-backed; often used for /tmp and /run; cleared on rebootNFS Remote storage mounted over the network/proc /sys /dev Virtual; generated by the kernel, nothing stored on diskHow to Check Filesystems, Space, and Inodes
df -hT # size, usage, and type per mountdf -i # inode usage (separate from space)lsblk -f # block devices with filesystem type and UUIDfindmnt # tree of mountsstat -f /var/log # filesystem info for a path # Check a filesystem (unmount it first, or use a dry run)sudo fsck -n /dev/sdb1Persistent mounts are configured in /etc/fstab:
UUID=abc123 / ext4 defaults 0 1UUID=def456 /data xfs defaults,noatime 0 2tmpfs /tmp tmpfs defaults,size=2G 0 0Troubleshooting Filesystems
| Symptom | Command | What to Look For |
|---|---|---|
| Disk full | df -h |
Use% at 100 |
| Cannot create files, space free | df -i |
Inodes at 100% |
| Became read-only | dmesg | grep -i error |
Kernel found errors |
| Mount missing after reboot | cat /etc/fstab |
Missing or wrong UUID |
TipA filesystem can run out of inodes while gigabytes remain free, typically with millions of tiny files such as caches or mail spools. Check
df -inext todf -h.
Remember
/proc,/sys, and most of/devhold no data on disk. The kernel builds them in memory, so they cannot fill your disk.
Frequently Asked Questions
Why do production servers usually use ext4 or XFS?
ext4 is mature, widely supported, and journaled for crash safety. XFS handles very large files and heavy parallel I/O well, which suits database and storage servers.
Why can writing to /proc/sys disappear after a reboot?
Those files are kernel interfaces, not stored data. A value written there lasts until reboot, so persist it in a file under `/etc/sysctl.d/` instead.
What is the difference between a filesystem and a partition?
A partition is a slice of a disk. A filesystem is the structure written onto that slice (or onto a whole device) so files can be stored and found.