Open In App

iostat command in Linux with examples

The iostat command in Linux is used for monitoring system input/output statistics for devices and partitions. It monitors system input/output by observing the time the devices are active in relation to their average transfer rates. The iostat produce reports may be used to change the system configuration to raised balance the input/output between the physical disks. iostat is being included in sysstat package. If you don’t have it, you need to install first. 

Command to install on different Distros:  



yum install sysstat
apt-get install sysstat

Note: 10 Linux iostat Command to Report CPU and I/O Statistics are listed below: 

1) iostat Command: The iostat command in linux is used to get report and statistic. 



Syntax: 

iostat

Example: Here’s a sample. 

The first section contains CPU report: 

 

The second section of the output contains device utilization report: 

iostat uses files mentioned below to create the reports:  

2) iostat -x Command: This command shows more details statistics information. iostat command gives I/O devices report utilization as a result. So it’s possible to extend the statistic result for a diagnose in depth with the -x option. 

Syntax: 

iostat -x

Example: 

iostat -c

Example: 

4) iostat -d Command: This command displays only the device report. It is possible to only show the status of the device utilization with the help of -d option. It will be going to list information for each connected device. 

Syntax: 

iostat -d

Example: 

5) iostat -xd Command: This command shows us the extended I/O statistic for device only. We can display extended the statistic on one side and from the other side we can display the extended statistics. It means that we can display the extended statistics only for devices with the help of -xd option as below: 

Syntax: 

iostat -xd

Example: 

6) iostat -k Command: This command captures the statistics in kilobytes or megabytes. By default, iostat measure the I/O system with the bytes unit. To make it easier to read, we can convert the iostat to show us reports in kilobytes or megabytes unit. 

Syntax: 

iostat -k

Example: 

7) iostat -m Command: Used to create a report with megabytes unit. 

Syntax: 

iostat -m

Example: 

8) iostat -k 2 3 Command: This command displays CPU and device statistics with delay. Same with the vmstat, as a statistic tool is the best way to use it with delay parameter. With the delay, we can see that what’s the trend. Here are some of the samples to run iostat with delay. 

Syntax: 

iostat -k 2 3

Example: 

9) iostat -c 2 2 Command: To show CPU only report with 2 seconds interval and 2 times reports. 

Syntax: 

iostat -c 2 2

Example: 

10) iostat -d sda7 sda6 2 2 Command: To show sda6 and sda7 device only report with 2 seconds interval and 2 times reports. 

Syntax:  

iostat -d sda7 sda6 2 2

Example: 

11) iostat -j ID mmcbkl0 sda6 -x -m 2 2 Command: This command Display’s persistent device name statistics. It is possible to print the report by device name. Instead of the standard /dev/sda name, it will be going to print the persistent device name with -j parameter and adding ID keyword (specify the type of the persistent name). 

Syntax: 

iostat -j ID mmcbkl0 sda6 -x -m 2 2

Example: 

12) iostat -p Command: This command display statistics for block devices. With the help of this command, it is possible to directly show information for each block device automatically. No need to indicate each of the device names. It will display statistics for block devices and all their partitions that are being used by the system. If a device name is entered on the command line, then the statistics for it and all of its partitions are displayed. Just use this -p option. 

Syntax: 

iostat -p

Example: 

13) iostat -N Command: Display lvm2 statistic information. It is possible to view the LVM statistic with -N option. This command displays the registered device mapper names for any of the device mapper devices. 

Syntax: 

iostat -N

Example: 


Article Tags :