iostat
说明
选项说明
选项
说明
输出列说明
列名
说明
实例演示



使用示例
不加 -N 和加 -N 结果对比
-x 选项输出结果说明
-x 输出结果
实验:判断是大 IO 还是小 IO
模拟磁盘写入
iostat 监控
计算 IO 大小
Last updated



Last updated
# 用 -yz 可以忽略干扰实时监控
iostat -yz 1 3iostat
# 查看指定磁盘 sda
iostat sda
# 使用 MB 为单位进行显示
iostat sda -m
# 持续显示,间隔 1s
iostat -d sda 1
# 1s 间隔,连续显示 5 次
iostat -d sda 1 5
# 显示 sda 设备的分区,1s 间隔,连续显示 5 次
iostat -d -p sda 1 5
# -N Display the registered device mapper names for any device mapper devices.
# Useful for viewing LVM2 statistics.
iostat -N
# -x 显示更详细的信息,1s 间隔,连续显示 5 次
iostat -x -d sda 1 5
# # 1s 间隔,连续显示 5 次
iostat -d sda 1 5
# 查看 CPU 状态
iostat -ciostat
Linux 5.14.0-362.8.1.el9_3.x86_64 (rocky1) 07/19/2024 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.12 0.01 0.20 0.00 0.00 99.67
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
dm-0 0.54 0.93 16.99 0.00 893895 16288840 0
dm-1 0.00 0.00 0.00 0.00 2216 220 0
dm-2 0.00 0.00 0.00 0.00 1140 2048 0
sda 0.50 1.00 16.99 0.00 956441 16293177 0
sr0 0.00 0.00 0.00 0.00 2096 0 0iostat -N
Linux 5.14.0-362.8.1.el9_3.x86_64 (rocky1) 07/19/2024 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.12 0.01 0.20 0.00 0.00 99.67
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
rl_miwifi--rb06--srv-root 0.54 0.93 16.99 0.00 893895 16288840 0
rl_miwifi--rb06--srv-swap 0.00 0.00 0.00 0.00 2216 220 0
rl_miwifi--rb06--srv-home 0.00 0.00 0.00 0.00 1140 2048 0
sda 0.50 1.00 16.99 0.00 956441 16293177 0
sr0 0.00 0.00 0.00 0.00 2096 0 0Device:
This column gives the device (or partition) name as listed in the /dev directory.
tps Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the de‐
vice. Multiple logical requests can be combined into a single I/O request to the device. A transfer is of indetermi‐
nate size.
Blk_read/s (kB_read/s, MB_read/s)
Indicate the amount of data read from the device expressed in a number of blocks (kilobytes, megabytes) per second.
Blocks are equivalent to sectors and therefore have a size of 512 bytes.
Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s)
Indicate the amount of data written to the device expressed in a number of blocks (kilobytes, megabytes) per second.
Blk_dscd/s (kB_dscd/s, MB_dscd/s)
Indicate the amount of data discarded for the device expressed in a number of blocks (kilobytes, megabytes) per sec‐
ond.
Blk_w+d/s (kB_w+d/s, MB_w+d/s)
Indicate the amount of data written to or discarded for the device expressed in a number of blocks (kilobytes,
megabytes) per second.
Blk_read (kB_read, MB_read)
The total number of blocks (kilobytes, megabytes) read.
Blk_wrtn (kB_wrtn, MB_wrtn)
The total number of blocks (kilobytes, megabytes) written.
Blk_dscd (kB_dscd, MB_dscd)
The total number of blocks (kilobytes, megabytes) discarded.
Blk_w+d (kB_w+d, MB_w+d)
The total number of blocks (kilobytes, megabytes) written or discarded.
r/s The number (after merges) of read requests completed per second for the device.
w/s The number (after merges) of write requests completed per second for the device.
d/s The number (after merges) of discard requests completed per second for the device.
f/s The number (after merges) of flush requests completed per second for the device. This counts flush requests executed
by disks. Flush requests are not tracked for partitions. Before being merged, flush operations are counted as
writes.
sec/s (kB/s, MB/s)
The number of sectors (kilobytes, megabytes) read from, written to or discarded for the device per second.
rsec/s (rkB/s, rMB/s)
The number of sectors (kilobytes, megabytes) read from the device per second.
wsec/s (wkB/s, wMB/s)
The number of sectors (kilobytes, megabytes) written to the device per second.
dsec/s (dkB/s, dMB/s)
The number of sectors (kilobytes, megabytes) discarded for the device per second.
rqm/s The number of I/O requests merged per second that were queued to the device.
rrqm/s The number of read requests merged per second that were queued to the device.
wrqm/s The number of write requests merged per second that were queued to the device.
drqm/s The number of discard requests merged per second that were queued to the device.
%rrqm The percentage of read requests merged together before being sent to the device.
%wrqm The percentage of write requests merged together before being sent to the device.
%drqm The percentage of discard requests merged together before being sent to the device.
areq-sz
The average size (in kilobytes) of the I/O requests that were issued to the device.
Note: In previous versions, this field was known as avgrq-sz and was expressed in sectors.
rareq-sz
The average size (in kilobytes) of the read requests that were issued to the device.
wareq-sz
The average size (in kilobytes) of the write requests that were issued to the device.
dareq-sz
The average size (in kilobytes) of the discard requests that were issued to the device.
await The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent
by the requests in queue and the time spent servicing them.
r_await
The average time (in milliseconds) for read requests issued to the device to be served. This includes the time spent
by the requests in queue and the time spent servicing them.
w_await
The average time (in milliseconds) for write requests issued to the device to be served. This includes the time spent
by the requests in queue and the time spent servicing them.
d_await
The average time (in milliseconds) for discard requests issued to the device to be served. This includes the time
spent by the requests in queue and the time spent servicing them.
f_await
The average time (in milliseconds) for flush requests issued to the device to be served. The block layer combines
flush requests and executes at most one at a time. Thus flush operations could be twice as long: Wait for current
flush request, then execute it, then wait for the next one.
aqu-sz The average queue length of the requests that were issued to the device.
Note: In previous versions, this field was known as avgqu-sz.
%util Percentage of elapsed time during which I/O requests were issued to the device (bandwidth utilization for the de‐
vice). Device saturation occurs when this value is close to 100% for devices serving requests serially. But for de‐
vices serving requests in parallel, such as RAID arrays and modern SSDs, this number does not reflect their perfor‐
mance limits.iostat -x -d sda 1 5
Linux 5.14.0-362.8.1.el9_3.x86_64 (rocky1) 07/19/2024 _x86_64_ (2 CPU)
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.03 1.00 0.00 4.69 0.44 39.53 0.47 17.01 0.06 11.01 2.72 36.07 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.03
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Device r/s rkB/s rrqm/s %rrqm r_await rareq-sz w/s wkB/s wrqm/s %wrqm w_await wareq-sz d/s dkB/s drqm/s %drqm d_await dareq-sz f/s f_await aqu-sz %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00dd if=/dev/zero of=/tmp/test.1 bs=8k count=102400 oflag=directiostat -d sda 1 100
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda 13762.00 0.00 110096.00 0.00 0 110096 0
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda 13672.00 0.00 109376.00 0.00 0 109376 0
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda 13710.00 0.00 109680.00 0.00 0 109680 0
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda 8460.00 0.00 67680.00 0.00 0 67680 0
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda 0.00 0.00 0.00 0.00 0 0 0
Device tps kB_read/s kB_wrtn/s kB_dscd/s kB_read kB_wrtn kB_dscd
sda 0.00 0.00 0.00 0.00 0 0 0# (kB_read/s + kB_wrtn/s) / tps
# 选两组数据
bc
109680/13710
8
109680/13710
8