Understanding Linux File Systems

A file system determines how data is organized on a storage device — how directories are structured, how metadata (permissions, timestamps, ownership) is stored, how the system recovers from crashes, and how efficiently it handles different workloads. Choosing the right file system for a workload matters more than most people realize: the wrong choice can cost performance, limit file sizes, or cause data loss in a crash.

What a file system does

Storage device (SSD/HDD)
      |
      ├── Superblock         — File system metadata: type, size, state
      ├── Inode table        — Per-file metadata: size, permissions, timestamps, block pointers
      ├── Directory entries  — Maps filenames to inode numbers
      └── Data blocks        — Actual file content

When you access /var/log/syslog:
1. Kernel reads /var inode  → finds /var/log directory
2. Reads /var/log inode     → finds syslog file's inode number
3. Reads syslog inode       → finds data block addresses
4. Reads data blocks        → returns file content

How Linux organizes file systems

Linux uses a single unified directory tree. All file systems — whether on a local disk, NFS share, or USB drive — are mounted at a point in this tree. There is no concept of drive letters (C:, D:) as on Windows.

# See the current mount hierarchy
findmnt

# See all mounted file systems with usage
df -hT

df -hT output on a typical Ubuntu server

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda1      ext4       50G   15G   33G  32% /
/dev/sda2      ext4      200G   80G  110G  43% /home
tmpfs          tmpfs      16G     0   16G   0% /dev/shm
/dev/sdb1      xfs       500G  120G  380G  24% /data

Common Linux file systems compared

File SystemMax file sizeMax volumeJournalingBest for
ext416 TiB1 EiBYes (metadata)General purpose; Ubuntu default
XFS8 EiB8 EiBYes (metadata)Large files, high-throughput databases
Btrfs16 EiB16 EiBCopy-on-writeSnapshots, subvolumes, NAS
tmpfsRAM-limitedRAMNo (RAM only)/tmp, /run, shared memory
FAT324 GiB2 TiBNoUSB drives, cross-OS compatibility
exFAT128 PiB128 PiBNoLarge USB/SD cards for cross-OS use

Checking your current file systems

# Show file system type for all partitions
lsblk -f

# Show detailed info about a specific file system
sudo tune2fs -l /dev/sda1 | head -20    # ext4
sudo xfs_info /dev/sdb1                 # XFS
sudo btrfs filesystem show /data        # Btrfs

# Check file system health
sudo fsck -n /dev/sda2    # -n = dry run, read-only check (on UNMOUNTED fs only!)

# Show inode usage (running out of inodes = "no space" even with free blocks)
df -i

df -i showing inode usage

Filesystem       Inodes  IUsed  IFree IUse% Mounted on
/dev/sda1       3276800 250000 3026800    8% /
/dev/sda2       3276800 3276790      10  100% /var/spool/mail

⚠️ WARNING: Running out of inodes (IUse% 100%) causes "No space left on device" errors even when disk usage is low. This happens when a directory contains millions of small files (mail spools, session files, cache directories). Use df -i to check inode usage alongside disk usage when diagnosing "no space" errors.

Choosing the right file system

WorkloadRecommended FSReason
Ubuntu system partition (/)ext4Stable, well-tested, excellent tooling
Database storage (MySQL, PostgreSQL)XFS or ext4XFS for large sequential I/O; ext4 for mixed
NAS / home server with snapshotsBtrfsBuilt-in snapshots, checksums, RAID support
High write throughput log storageXFSBetter parallel write performance than ext4
Temporary files (/tmp)tmpfsRAM-based, automatically cleared on reboot

Conclusion

Ext4 is the right choice for most Ubuntu systems — it is stable, well-understood, and has excellent tools. Choose XFS for database or log storage with large files and high write throughput. Choose Btrfs when you need built-in snapshots or checksumming (like on a NAS). Always check both disk space (df -h) and inode usage (df -i) when diagnosing "no space left on device" errors — they have different causes and different fixes.

FAQ

Is Understanding Linux File Systems important for Ubuntu administrators?+

Yes. It supports practical Ubuntu administration because it connects directly to server reliability, security, troubleshooting, or daily operations.

Should I practice this on a live server?+

Use a lab VM first. After you understand the command output and rollback path, apply the workflow carefully on real systems.

What should I do after reading this article?+

Run the practice commands, write down what each one shows, and continue to the next article in the Ubuntu roadmap.

Need help with Ubuntu administration?

Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.

Hire Me for Support