You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何理解vmstat的IO输出?block device含义及数值无变化疑问

Hey there! Let's break down your questions about vmstat on Ubuntu step by step.

What exactly is a "block device"?

A block device is any storage device that the OS reads from and writes to in fixed-size "blocks" (usually 1KB on Ubuntu, though this can vary). It's not limited to just local physical disks—this category includes:

  • Local spinning HDDs or SSDs (like /dev/sda, /dev/nvme0n1)
  • LVM logical volumes, RAID arrays
  • Network-attached block storage (like iSCSI targets)
  • Even loop devices (used for mounting ISO files, for example)

The key point is: it's a device that interacts with the system at the block level, unlike file-level storage (like NFS shares, which are handled by the network filesystem layer instead of the block device layer).

Why didn't the IO stats change when copying a large file?

This is super common, and usually boils down to one of these scenarios:

  • Linux's page cache is doing its job: Linux automatically caches frequently accessed files in RAM to speed up operations. If the large file you copied was already cached in memory, the copy operation would happen entirely in RAM—no actual disk read/write needed. To test this, clear the cache first (you'll need sudo privileges):
    sudo echo 3 > /proc/sys/vm/drop_caches
    
    Then run your copy command while monitoring vmstat in real time (use vmstat 1 to refresh every second).
  • You're not monitoring in real time: By default, vmstat only outputs a single snapshot of system stats. If you just ran vmstat once before and after the copy, you might miss the transient IO activity. Use vmstat [interval] [count] (e.g., vmstat 1 10) to get continuous updates.
  • The file is on a non-block device storage: If you're copying files on an NFS/SMB share or other file-level network storage, vmstat's block device stats won't track that activity—since those aren't block devices. For those, you'd need tools like nfsstat instead.
How to interpret vmstat's IO output

First, let's look at a typical vmstat output (run vmstat 1 to get real-time data):

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 789240  14520 2105600    0    0     0     0  189  521  2  1 97  0  0

Focus on the -----io---- section and the wa CPU column:

  • bi: Blocks received from block devices (units: blocks per second). This counts data being read from disk (or other block devices) into system memory. A consistently high value means your system is doing a lot of disk reads.
  • bo: Blocks sent to block devices (units: blocks per second). This counts data being written from memory to disk. High values here mean heavy disk write activity.
  • wa (under CPU): Percentage of CPU time spent waiting for I/O operations to complete. If this number is consistently above 10-15%, it's a sign that your disk subsystem is a bottleneck—your CPU is sitting idle waiting for disk operations to finish.

A quick tip: For more granular per-device IO stats, install the sysstat package and use iostat -x 1—it'll show you read/write speeds, latency, and utilization for each individual block device.

内容的提问来源于stack exchange,提问作者Joey Yi Zhao

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:22:32