Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

Linux & Mac & Bash Command Dictionary

  1. Home
  2. Linux & Mac & Bash Command Dictionary
  3. vmstat / iostat (Performance Statistics)

vmstat / iostat (Performance Statistics)

vmstat is a command that outputs real-time statistics for memory, swap, CPU, and I/O. iostat is a command that displays I/O throughput and latency per disk device. Both are lightweight tools useful for quickly identifying performance bottlenecks in combination with scripts or monitoring utilities. When a server feels slow under heavy load, the standard approach is to first check vmstat to see whether swapping is occurring and whether the CPU is stalled on I/O wait, then use iostat to identify the specific disk causing the problem.

Syntax

# -----------------------------------------------
#  vmstat syntax
# -----------------------------------------------

# vmstat [options] [interval (seconds)] [count]
#   → Without interval or count, prints a single line of current statistics
#   → With only an interval, repeats until stopped with Ctrl+C
#   Example: vmstat 1 5  (output 5 times at 1-second intervals)

# Common options
#   -a   → Show active/inactive memory instead of buff/cache
#   -d   → Show disk statistics (similar information to iostat)
#   -s   → Show a summary of memory statistics
#   -S M → Change the unit for values to megabytes (MB)
#   -w   → Widen column widths to prevent values from being truncated
#   -t   → Add a timestamp column

# -----------------------------------------------
#  iostat syntax
# -----------------------------------------------

# iostat [options] [interval (seconds)] [count]
#   → Included in the sysstat package (install via apt/dnf if not present)
#   Example: iostat -xh 1 3  (extended info in human-readable units, 3 times at 1-second intervals)

# Common options
#   -x   → Show extended statistics (await, %util, etc.)
#   -h   → Display values in human-readable units (K/M/G)
#   -d   → Show disk statistics only (exclude CPU statistics)
#   -p {device}
#        → Show only the specified device and its partitions
#        Example: iostat -xh -p sda 1

Reference

Command / ColumnDescription
vmstat 1 5Outputs memory, swap, CPU, and I/O statistics 5 times at 1-second intervals. The first line is a cumulative total since boot, so treat it as a rough reference.
vmstat -S M 1Outputs statistics every second with values in MB. Makes values easier to read on servers with large amounts of memory.
vmstat -aShows active/inactive memory instead of buff/cache. Useful for determining whether memory can be reclaimed.
vmstat -sDisplays a vertical summary of memory statistics. Lets you check total and used swap space at a glance.
vmstat: rNumber of processes waiting to run (run queue). A value that consistently exceeds the number of CPU cores is a sign of CPU saturation.
vmstat: bNumber of processes sleeping in I/O wait (blocked). A sustained value above 0 indicates the disk is a bottleneck.
vmstat: swpdAmount of swap space in use (KB). A value above 0 indicates that physical memory is insufficient.
vmstat: freeUnused physical memory (KB). Linux uses free memory for caching, so a small value does not necessarily indicate a problem.
vmstat: buffBuffer cache (KB). Holds metadata for block devices and similar data.
vmstat: cachePage cache (KB). Speeds up file reads and writes. The kernel frees this memory when physical memory runs low.
vmstat: siSwap-in rate (KB/s). The amount being read back from disk into memory. A high value indicates a serious memory shortage.
vmstat: soSwap-out rate (KB/s). The amount being moved from memory to disk. If this is consistently non-zero, consider adding more memory.
vmstat: biBlocks read from block devices per second. Represents the read load on disks.
vmstat: boBlocks written to block devices per second. Represents the write load on disks.
vmstat: inInterrupts per second. Increases when there are many interrupts from NICs or HBAs.
vmstat: csContext switches per second. A very high value may indicate too many processes or excessive I/O wait.
vmstat: usCPU time spent in user space (%). Represents the portion consumed by application processing.
vmstat: syCPU time spent in kernel space (%). A high value may indicate excessive system calls or interrupt handling.
vmstat: idCPU idle percentage (%). The closer to 100, the more headroom the CPU has.
vmstat: waPercentage of CPU time spent waiting for I/O (%). A value that consistently exceeds 10–20% indicates a disk bottleneck.
iostat -xh 1 3Outputs extended statistics in human-readable units 3 times at 1-second intervals. Allows you to check the load per device in detail.
iostat: tpsTransfers per second to the device. Equivalent to IOPS.
iostat: kB_read/sRead throughput (KB/s).
iostat: kB_wrtn/sWrite throughput (KB/s).
iostat: awaitAverage wait time for I/O requests (milliseconds). A normal baseline is a few milliseconds for SSDs and around 10–20 ms for HDDs.
iostat: %utilDevice utilization (%). Values above 70% are a sign of saturation. At 100%, I/O is a complete bottleneck.

Examples

Sample vmstat output
$ vmstat 1 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  1 512000  48320  12800 380000  120  240  3200  1800 1450 2800 35 15 40 10  0
 3  2 518000  44100  12800 376000  180  320  4800  2200 1820 3400 42 18 28 12  0
 4  3 524000  40200  12800 372000  240  400  6400  2600 2100 4000 48 20 18 14  0
 3  2 528000  38400  12800 370000  200  360  5600  2400 1950 3700 44 19 24 13  0
 2  1 530000  37600  12800 368000  160  280  4200  2000 1700 3200 38 16 34 12  0
# ↑ swpd keeps increasing (memory shortage), si/so are non-zero (swapping is occurring)
# ↑ b column is 1–3 (processes waiting on I/O), wa is 10–14% (disk I/O wait is occurring)
# ↑ In this situation, use iostat to identify which disk is the cause
Sample iostat output
$ iostat -xh 1 3
Linux 5.14.0 (jujutsu-srv)   2026-03-25   _x86_64_   (4 CPU)

          rrqm/s  wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util Device
            0.00    8.50   45.20   32.80     6.2M     4.1M   210.0k     2.40   24.5    18.2    33.8    5.2  40.3% sda
            0.00    0.20  128.40   95.60    18.4M    12.8M   245.0k     7.80   38.2    22.4    58.6    5.8  82.6% sdb
            0.00    0.10    2.30    1.80   256.0k   128.0k    72.0k     0.02    5.1     4.8     5.6    4.9   2.0% sdc

          rrqm/s  wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util Device
            0.00    9.10   48.30   35.20     6.6M     4.4M   215.0k     2.60   25.1    19.0    34.5    5.3  41.8% sda
            0.00    0.30  142.80  108.20    20.1M    14.5M   252.0k     9.20   46.3    27.1    69.8    5.9  93.2% sdb
            0.00    0.10    2.10    1.60   240.0k   112.0k    69.0k     0.02    4.9     4.7     5.3    4.8   1.8% sdc

# ↑ sdb %util is 82–93% (nearly saturated)
# ↑ sdb await is 38–46 ms (write wait w_await is especially high)
# ↑ sdb is the bottleneck. Write volume (wMB/s) is also high — the HDD may have reached its limit

Overview

vmstat and iostat are fundamental tools commonly used for Linux performance diagnostics. When troubleshooting, the typical workflow is to first check top / htop to see which processes are consuming CPU or memory, then use vmstat to determine whether swapping is occurring and whether the CPU is stalled on I/O wait. If the wa (I/O wait) column in vmstat is high or the b column (processes blocked on I/O) is growing, use iostat -xh to inspect %util and await per device and pinpoint which disk is congested. A %util above 70% warrants attention; at 100%, the device is fully saturated and is the I/O bottleneck. If swpd continues to grow and si/so (swap-in/swap-out) are consistently non-zero, the cause is physical memory exhaustion. In that case, consider stopping unnecessary processes or adding more memory. If you want to record statistics periodically and track trends over time, using sar / sysstat alongside these tools is recommended.

If you find any errors or copyright issues, please .