The CPU is the brain of a computer. All the processing commands are running on the top. I/O (input/output) also plays an important role. The hard disk is used to provide data to the processor and to save data processed by the CPU. One way to measure processor and I/O utilization is to use the iostat command. Through their utilization, we can decide whether to add more resources.
What is Iostat?
Iostat monitors the system's input/output device load by observing the relationship between the active time of the device and their average transfer rate. Iostat generated reports can be used to modify the system configuration to better balance input/output reports between physical hard disks.
Installing Iostat
The iostat is contained within the Sysstat package. If you don't, you need to install it first.
In Redhat/centos/fedora
# yum Install Sysstat
In Debian/ubuntu/linux Mint
$ sudo apt-get install Sysstat
How to run Iostat
To run it, simply enter Iostatunder the console. Here is an example.
$ iostat
Here's how to read the Iostat default report the first part contains the CPU report
- %user : Shows CPU utilization when executing user (application) tier
- %nice : Shows CPU utilization at the user tier running at Nice priority
- %system : Shows CPU utilization when executing the system (kernel) layer
- %iowait : Shows the percentage of idle time when the CPU is suspended for I/O requests
- %steal : Shows the percentage of time that the virtual CPU is unconsciously waiting for when Hypervisor is serving a second virtual processor.
- %idle : Shows the percentage of idle time when the CPU has no pending requests for I/O
The second part contains the equipment utilization report
- Device: The unit/partition name listed in the/ dev Directory
- TPS : Displays the number of transmissions to the device per second. A higher TPS means that the processor is busier.
- blk_read/s : Shows the number of blocks read from the device per second (KB,MB)
- blk_wrtn/s : Shows the number of blocks written to the device per second (KB,MB)
- blk_read : Show all blocks read
- Blk_wrtn : Show all written blocks
Capture Iostat in KB or MB
By default, iostat measures the I/O system in units B. To make it easier to read, we can iostat to convert the report to either KB or MB. You only need to add the- k parameter to create the-m parameter in kilobytes to create in megabytes .
$ iostat-k
$ iostat-m
To extend the report, we can follow the- x option behind Iostat.
$ iostat-x
"Iostat" on Linux