Understanding Disk Types, I/O Mechanics, and Performance Metrics in Linux
This article explains the fundamentals of disks, differentiates mechanical HDDs and SSDs, describes disk I/O concepts, outlines key performance metrics such as IOPS, throughput, utilization and saturation, and introduces Linux tools like iostat, iotop and sar for monitoring and analyzing storage performance.
1. What Is a Disk
Before discussing disk I/O, a brief overview of disks is provided. A disk is a persistent storage device and can be classified into two common types based on the storage medium: mechanical disks and solid‑state disks.
1.1 Mechanical Disk
The first type, mechanical disk (Hard Disk Drive, HDD), mainly consists of platters and read/write heads. Data is stored in concentric tracks on the platters. Before reading or writing, the head must move to the correct track, which introduces seek time. Continuous I/O avoids seeks and yields the best performance, while random I/O requires frequent head movement and is slower.
1.2 Solid‑State Disk
The second type, Solid‑State Disk (SSD), is built from solid‑state electronic components and does not require track seeking. Consequently, both sequential and random I/O perform much better than on mechanical disks.
1.3 Comparison of Mechanical and Solid‑State Disks
For the same disk, random I/O is always slower than sequential I/O. The reasons are:
Mechanical disks suffer from head seek and platter rotation overhead for random I/O.
SSDs, although faster for random I/O, still incur write‑amplification due to erase‑before‑write and garbage collection.
Sequential I/O can benefit from pre‑fetching, reducing the number of I/O requests.
Both disk types also have a minimum read/write unit.
Mechanical disks use a sector, typically 512 bytes.
SSDs use a page, commonly 4 KB, 8 KB, etc.
Linux filesystems group consecutive sectors or pages into logical blocks (usually 4 KB) to improve efficiency.
1.4 Disk Classification by Interface
Disks can also be classified by interface, such as IDE, SCSI, SAS, SATA, and Fibre Channel. Different interfaces assign different device name prefixes (e.g., hd for IDE, sd for SCSI/SATA). Multiple disks of the same type are numbered a, b, c, …
1.5 Disk Architecture
When attached to a server, disks can be used in several architectures:
Standalone independent disks, often partitioned (e.g., /dev/sda1, /dev/sda2).
Multiple disks combined into a logical RAID array to improve performance and reliability (RAID0, RAID1, RAID5, RAID10, etc.).
Network‑attached storage clusters exposed via NFS, SMB, iSCSI, etc., commonly used by cloud servers.
In Linux, a disk is managed as a block device, identified by a major and minor device number.
2. What Is Disk I/O
Disk I/O (Input/Output) refers to the read and write operations between the computer system and the storage device. When a program needs data, the OS issues a read request; when it needs to store data, it issues a write request.
Programs cannot execute directly from disk; the code must first be loaded into memory. The CPU fetches instructions from memory, not directly from the disk, because disk access is much slower.
While a program runs in memory, it may need to load additional files. The OS provides system calls to open files, read their contents, and load the data into memory, similar to opening a book before reading.
When the CPU issues a file‑read command, it waits for the OS to signal that the data is ready. During this wait, the CPU may execute other tasks rather than staying idle.
Note 1: When the CPU waits for a disk operation, its utilization drops because it is waiting for I/O rather than performing computation. Note 2: Memory acts as a bridge between CPU and disk; programs are loaded into memory before the CPU can execute them, and results are written back to memory and eventually to disk.
3. Disk Performance Metrics
Five common metrics are used to evaluate disk performance: utilization, saturation, IOPS, throughput, and response time.
IOPS (Input/Output Operations Per Second) : Number of I/O requests processed per second.
Throughput : Amount of data transferred per second (e.g., MB/s). Typical values: HDD 80‑150 MB/s, SAS 150‑200 MB/s, SSD 400‑600 MB/s.
Response time : Time from issuing an I/O request to receiving the response.
Utilization : Percentage of time the disk spends handling I/O. High utilization (>80 %) often indicates a bottleneck, but it does not consider I/O size.
Saturation : Degree to which the disk is busy; at 100 % saturation the disk cannot accept new I/O.
When analyzing performance, consider read/write ratios, I/O type (random vs. sequential), and request size. For random‑heavy workloads (databases, many small files), IOPS is more indicative; for sequential workloads (media files), throughput matters more.
4. Disk I/O Observation
Understanding metrics is the first step; the next step is to observe them using tools.
4.1 Observing Each Disk's Usage
iostat(I/O statistics) monitors disk activity and CPU usage. It reports overall system I/O but not per‑process details.
# iostat belongs to the sysstat package. Install with:
yum install sysstat -yCommon options:
-c: show CPU utilization only
-d: show disk I/O only
-k: display output in KB/s
-t: add timestamp to output
-m: display in MB/s
-p: show statistics for each block device and its partitions
-V: display version and exit
-x: display extended statisticsKey fields in iostat output: %util: Disk I/O utilization. r/s + w/s: IOPS. rkB/s + wkB/s: Throughput. r_await / w_await: Response time.
Also consider request size fields ( rareq‑sz, wareq‑sz) when evaluating performance.
4.2 Observing Process I/O
To see which processes generate I/O, use iotop, a top‑like utility that sorts processes by I/O usage.
# install yum -y install iotopKey options:
--version show version
-h, --help show help
-o, --only show only actual I/O of processes/threads
-b, --batch run in non‑interactive mode
-n NUM, --iter=NUM number of iterations
-d SEC, --delay=SEC delay between updates
-p PID, --pid=PID show only specified PID
-u USER, --user=USER show only processes of a user
-P, --processes show processes (default shows threads)
-a, --accumulated show accumulated I/O since start
-k, --kilobytes display in kilobytes
-t, --time prepend timestamp to each line
-q, --quiet suppress header lines (repeatable up to three times)Sample output:
$ iotop
Total DISK READ : 0.00 B/s | Total DISK WRITE : 7.85 K/s
Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
15055 be/3 root 0.00 B/s 7.85 K/s 0.00 % 0.00 % systemd-journaldThe output shows total read/write bytes per second, per‑process I/O, and each process's I/O utilization.
4.3 Additional I/O Commands
(1) sar – collects historical performance data. Example to view disk statistics:
# sar -d -p 1 2
Linux 3.10.0-1160.59.1.el7.x86_64 (106) 2024-04-18 _x86_64_ (8 CPU)
17:33:33 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
... (output omitted for brevity) ...Use -f /var/log/sa/saXX to read saved logs (default three days).
(2) Other common I/O tools are illustrated in the following diagram:
5. Summary
This article covered disk types, Linux I/O concepts, key performance metrics (IOPS, throughput, utilization, saturation, response time), and practical tools such as iostat, iotop, and sar for monitoring and analyzing storage performance. Effective analysis requires correlating metrics with workload characteristics like read/write ratio, I/O type, and request size.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
