Skip to main content

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.

flowchart TD A[Application] --> B[VFS layer] B --> C[ext4 disk] B --> D[XFS disk] B --> E[NFS network] B --> F[proc and sys virtual]

Common Linux Filesystems

TEXT
ext4 Default on many distributions; journaling, mature, general purpose
XFS Strong with large files and parallel I/O; default on RHEL and
Amazon Linux
Btrfs Snapshots and checksums; used on some distributions
ZFS Advanced features; usually installed separately
tmpfs RAM-backed; often used for /tmp and /run; cleared on reboot
NFS Remote storage mounted over the network
/proc /sys /dev Virtual; generated by the kernel, nothing stored on disk

How to Check Filesystems, Space, and Inodes

Bash
df -hT # size, usage, and type per mount
df -i # inode usage (separate from space)
lsblk -f # block devices with filesystem type and UUID
findmnt # tree of mounts
stat -f /var/log # filesystem info for a path
# Check a filesystem (unmount it first, or use a dry run)
sudo fsck -n /dev/sdb1

Persistent mounts are configured in /etc/fstab:

TEXT
UUID=abc123 / ext4 defaults 0 1
UUID=def456 /data xfs defaults,noatime 0 2
tmpfs /tmp tmpfs defaults,size=2G 0 0

Troubleshooting 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
Tip

A filesystem can run out of inodes while gigabytes remain free, typically with millions of tiny files such as caches or mail spools. Check df -i next to df -h.

Remember

/proc, /sys, and most of /dev hold 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.

Found a mistake, an outdated step or a broken link?