How To Use Iostat Command.
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:
On RedHat / CentOS / Fedora
On Debian / Ubuntu / Linux Mint
Note: 10 Linux iostat Command to Report CPU and I/O Statistics are listed below:
iostat: Get report and statistic.
iostat -x: Show more details statistics information.
iostat -c: Show only the cpu statistic.
iostat -d: Display only the device report.
iostat -xd: Show extended I/O statistic for device only.
iostat -k: Capture the statistics in kilobytes or megabytes.
iostat -k 2 3: Display cpu and device statistics with delay.
iostat -j ID mmcbkl0 sda6 -x -m 2 2: Display persistent device name statistics.
iostat -p: Display statistics for block devices.
iostat -N: Display lvm2 statistic information.
The iostat command in linux is used to get report and statistic.
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.
iostat -c Command: This command show only the CPU statistic. It is possible to show the statistic information and report of our cpu with -c option.
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.
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:
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.
iostat -m Command: Used to create a report with megabytes unit.
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.
iostat -c 2 2 Command: To show CPU only report with 2 seconds interval and 2 times reports.
iostat -d sda7 sda6 2 2 Command: To show sda6 and sda7 device only report with 2 seconds interval and 2 times reports.
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).
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.
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.