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 contentHow 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 System | Max file size | Max volume | Journaling | Best for |
|---|---|---|---|---|
| ext4 | 16 TiB | 1 EiB | Yes (metadata) | General purpose; Ubuntu default |
| XFS | 8 EiB | 8 EiB | Yes (metadata) | Large files, high-throughput databases |
| Btrfs | 16 EiB | 16 EiB | Copy-on-write | Snapshots, subvolumes, NAS |
| tmpfs | RAM-limited | RAM | No (RAM only) | /tmp, /run, shared memory |
| FAT32 | 4 GiB | 2 TiB | No | USB drives, cross-OS compatibility |
| exFAT | 128 PiB | 128 PiB | No | Large 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). Usedf -ito check inode usage alongside disk usage when diagnosing "no space" errors.
Choosing the right file system
| Workload | Recommended FS | Reason |
|---|---|---|
| Ubuntu system partition (/) | ext4 | Stable, well-tested, excellent tooling |
| Database storage (MySQL, PostgreSQL) | XFS or ext4 | XFS for large sequential I/O; ext4 for mixed |
| NAS / home server with snapshots | Btrfs | Built-in snapshots, checksums, RAID support |
| High write throughput log storage | XFS | Better parallel write performance than ext4 |
| Temporary files (/tmp) | tmpfs | RAM-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