Fundamentals 8 min read

Understanding Linux Filesystems and Disk I/O for Performance Tuning

This article explains Linux filesystem structures, the virtual filesystem layer, various disk I/O mechanisms—including buffered, non‑buffered, blocking, non‑blocking, synchronous and asynchronous I/O—and provides practical commands for observing inode and dentry caches to aid performance optimization.

Tech Stroll Journey
Tech Stroll Journey
Tech Stroll Journey
Understanding Linux Filesystems and Disk I/O for Performance Tuning

1. Filesystem and Disk

Before analyzing I/O performance, understand the relationship between filesystems and disks. Linux treats everything as a file; each file is represented by an inode that stores metadata, and directory entries point to these inodes. Inodes and directory entries are themselves files stored on disk.

Directory entries are cached in kernel memory (dentry cache) after boot, while inodes reside in the inode cache. The superblock, loaded at boot, holds fundamental filesystem information such as size, status, and policies.

2. Virtual Filesystem (VFS)

The VFS abstracts different concrete filesystems (ext4, XFS, etc.) behind a uniform interface, allowing applications to use standard system calls without caring about the underlying format. VFS structures are kept in memory and do not occupy disk space; examples include /proc and /sys.

Example: a disk /dev/sdb1 formatted with ext4 is mounted at /mnt; applications interact with it via VFS commands like cat, touch, rm. High‑performance storage may bypass VFS and use raw block devices directly.

3. Disk I/O Mechanisms

Data ultimately must be persisted to disk, and the I/O path determines performance. I/O can be buffered or non‑buffered; buffered I/O uses the page cache, while non‑buffered I/O bypasses it and issues direct system calls. Most applications enable non‑direct I/O to reduce kernel‑level I/O overhead and batch writes.

Key concepts include blocking vs. non‑blocking I/O and synchronous vs. asynchronous I/O. Blocking I/O stalls the process until the operation completes; non‑blocking returns immediately and requires the application to poll or handle completion events. Synchronous I/O waits for the result, whereas asynchronous I/O notifies the application via events.

4. Observation Tools

Useful commands for inspecting filesystem and I/O state:

df -i            # shows inode usage per filesystem
cat /proc/meminfo | grep -E "SReclaimable|Cached"   # shows page cache and reclaimable slab
cat /proc/slabinfo | grep -E '^#|dentry|inode'    # displays dentry and inode caches

In the slabinfo output, the “dentry” line corresponds to the directory entry cache.

Performance TuningLinuxdisk I/OVFSFilesysteminodes
Tech Stroll Journey
Written by

Tech Stroll Journey

The philosophy behind "Stroll": continuous learning, curiosity‑driven, and practice‑focused.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.