iostat: System I/O statistics, disk, and processor activity
August 9th, 2024 1:46 PM Mr. Q Categories: Command
Command: iostat
The iostat
command provides detailed information about system input/output (I/O) statistics, including disk usage and CPU load. It’s useful for monitoring system performance and identifying potential bottlenecks related to I/O operations.
Sample Commands and Outputs:
- Command:
iostat
Sample Command:
$ iostat
Sample Output:
[iostat output starts]
avg-cpu: %user %nice %system %iowait %steal %idle
10.53 0.00 5.14 0.30 0.00 84.03
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 12.34 1234.56 789.12 1234567 987654
[iostat output ends]
Description:
avg-cpu
: CPU usage statistics%user
: Percentage of CPU time spent in user space%nice
: Percentage of CPU time spent on processes with a positive nice value%system
: Percentage of CPU time spent in kernel space%iowait
: Percentage of CPU time spent waiting for I/O operations to complete%steal
: Percentage of CPU time stolen by the hypervisor from the virtual machine%idle
: Percentage of CPU time when the CPU is idle
Device
: Disk I/O statisticstps
: Number of transfers per secondkB_read/s
: Kilobytes read per secondkB_wrtn/s
: Kilobytes written per secondkB_read
: Total kilobytes readkB_wrtn
: Total kilobytes written
Options:
-d [seconds]
: Set the delay between updates (e.g.,iostat -d 5
updates every 5 seconds).-x
: Show extended statistics for devices, including I/O wait and utilization percentages.-c [count]
: Number of times to repeat the output (e.g.,iostat -c 3
).
Example with Options:
- Command:
iostat -x
Sample Command:
$ iostat -x
Sample Output:
[iostat -x output starts]
avg-cpu: %user %nice %system %iowait %steal %idle
10.53 0.00 5.14 0.30 0.00 84.03
Device: r/s w/s rKB/s wKB/s avgrq-sz avgqu-sz await svctm %util
sda 1.23 3.45 123.4 234.5 56.78 0.02 10.5 1.2 12.3
[iostat -x output ends]
Description:
r/s
: Number of read requests per secondw/s
: Number of write requests per secondrKB/s
: Kilobytes read per secondwKB/s
: Kilobytes written per secondavgrq-sz
: Average request size (in kilobytes)avgqu-sz
: Average queue size of the requestsawait
: Average time (in milliseconds) for I/O requests to completesvctm
: Average service time (in milliseconds) for I/O requests%util
: Percentage of time the device was busy processing I/O requests