iostat linux command:-
It displays information about CPU usage, and I/O statistics for every partition and network filesystems(NFS).It is default size is in KB.
[oracle@orcl:~ ] iostat Linux 2.6.32-696.el6.x86_64 (orcl.localdomain.com) 10/22/18 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.09 0.00 0.54 1.75 0.00 96.62 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 7.66 61.77 155.95 11792568 29771464
Options :
-c Display the CPU utilization report. -d Display the device utilization report. -h Make the NFS report displayed by option -n easier to read by a human. -k Display statistics in kilobytes per second instead of blocks per second. Data displayed are valid only with kernels 2.4 and later. -m Display statistics in megabytes per second instead of blocks or kilobytes per second. Data displayed are valid only with kernels 2.4 and later. -N Display the registered device mapper names for any device mapper devices. Useful for viewing LVM2 statistics. -n Display the network filesystem (NFS) report. This option works only with kernel 2.6.17 and later. -p [ { device [,...] | ALL } ] The -p option displays statistics for block devices and all their partitions that are used by the system. If a device name is entered on the command line, then statistics for it and all its partitions are displayed. Last, the ALL keyword indicates that statistics have to be displayed for all the block devices and partitions defined by the system, including those that have never been used. Note that this option works only with post 2.5 kernels. -t Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below). -V Print version number then exit. -x Display extended statistics. This option works with post 2.5 kernels since it needs /proc/diskstats file or a mounted sysfs to get the statistics. This option may also work with older kernels (e.g. 2.4) only if extended statistics are available in /proc/partitions (the kernel needs to be patched for that). -z Tell iostat to omit output for any devices for which there was no activity during the sample period.
Examples :
- iostat output in MB
[oracle@orcl:~ ] iostat -m Linux 2.6.32-696.el6.x86_64 (orcl.localdomain.com) 10/22/18 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.09 0.00 0.54 1.75 0.00 96.62 Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn sda 7.64 0.03 0.08 5760 14629
2. iostat with -c arguments displays only CPU statistics
[oracle@orcl:~ ] iostat -c Linux 2.6.32-696.el6.x86_64 (orcl.localdomain.com) 10/22/18 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.09 0.00 0.54 1.75 0.00 96.62
3. iostat with -c arguments displays only CPU statistics for every 2 seconds.
[oracle@orcl:~ ] iostat -c 2 Linux 2.6.32-696.el6.x86_64 (orcl.localdomain.com) 10/22/18 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.08 0.00 0.54 1.75 0.00 96.63 avg-cpu: %user %nice %system %iowait %steal %idle 0.00 0.00 0.51 0.00 0.00 99.49
4. iostat with -d arguments displays only disks I/O statistics of all partitions
[oracle@orcl:~ ] iostat -d Linux 2.6.32-696.el6.x86_64 (orcl.localdomain.com) 10/22/18 _x86_64_ (1 CPU) Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 7.66 61.71 155.87 11793016 29788536 dm-0 3.26 8.32 23.06 446295370 1237237064
5. It displays the I/O statistics for specific device sda
[oracle@orcl:~ ] iostat -p sda Linux 2.6.32-696.el6.x86_64 (orcl.localdomain.com) 10/22/18 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.08 0.00 0.54 1.75 0.00 96.62 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 7.65 61.62 155.75 11793576 29809400 sda1 0.00 0.14 0.00 26011 64 sda2 0.92 15.43 14.98 2952435 2866192 sda3 0.01 0.37 1.73 71657 331632 sda4 0.00 0.00 0.00 13 0 sda5 6.72 45.68 139.04 8742243 26611512
6. iostat version
[oracle@orcl:~ ] iostat -V sysstat version 9.0.4 (C) Sebastien Godard (sysstat <at> orange.fr)
7. It displays a usage of statement
[oracle@orcl:~ ] iostat -? Usage: iostat [ options ] [ <interval> [ <count> ] ] Options are: [ -c ] [ -d ] [ -N ] [ -n ] [ -h ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] [ -j { ID | LABEL | PATH | UUID | ... } [ <device> [...] | ALL ] ] [ <device> [...] | ALL ] [ -p [ <device> [,...] | ALL ] ]
The iostat command generates three types of reports, the CPU Utilization report, the Device Utilization report and the Network Filesystem report.
CPU utilization in iostat output :
avg-cpu: %user %nice %system %iowait %steal %idle 27.71 0.00 1.16 2.82 0.00 68.31
Columns in iostat CPU utlization output :
%user Show the percentage of CPU utilization that occurred while executing at the user level (application). %nice Show the percentage of CPU utilization that occurred while executing at the user level with nice priority. %system Show the percentage of CPU utilization that occurred while executing at the system level (kernel). %iowait Show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. %steal Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor. %idle Show the percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
Device Utilization in iostat output :
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn sda 7.59 60.05 154.04 11807456 30287688
To get more detailed statistics, we can use ‘-x’ option along with iostat command
[oracle@fhpasadbdr01 ~]$ iostat -x Linux 2.6.32-279.5.2.el6.x86_64 (fhpasadbdr01.pasa.pas.local) 10/22/2018 _x86_64_ (16 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 27.71 0.00 1.16 2.82 0.00 68.31 Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util sda 12.04 11.67 5.59 2.24 146.36 111.29 32.93 0.02 2.68 1.99 1.56 dm-0 0.00 0.00 0.37 2.88 8.32 23.06 9.64 0.04 12.51 1.49 0.49
Columns in iostat device utlization output :
The standard iostat device display shows the following statistics: KB/t kilobytes per transfer tps transfers per second MB/s megabytes per second The standard iostat device display, with the -I flag specified, shows the following statistics: KB/t kilobytes per transfer xfrs total number of transfers MB total number of megabytes transferred The old-style iostat display (using -o) shows the following statistics: sps sectors transferred per second tps transfers per second msps average milliseconds per transaction The old-style iostat display, with the -I flag specified, shows the following statistics: blk total blocks/sectors transferred xfr total transfers msps average milliseconds per transaction
Network file utilization in iostat output :
We can use nfsiostat command to generate the NFS i/o statistics reports. nfsiostat command is the part of the package ‘nfs-utils’. Let’s assume we have mounted two NFS shares on our server, so to generate the statistics report for NFS share run the below command,
[root@prod ~]$ nfsiostat orcl.localdomain.com:/ifs/backup mounted on /backup: op/s rpc bklog 9.50 0.00 read: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 2.492 261.008 104.749 0 (0.0%) 12.042 12.185 write: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 0.011 0.132 11.821 0 (0.0%) 4.042 8.698 orcl.localdomain.com:/ifs/orashare1 mounted on /orashare1: op/s rpc bklog 3.16 0.00 read: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 0.333 3.366 10.105 0 (0.0%) 4.081 4.264 write: ops/s kB/s kB/op retrans avg RTT (ms) avg exe (ms) 0.001 0.445 351.851 0 (0.0%) 23.907 9531.542
Click the link for more information about iostat
Catch Me On:- Hariprasath Rajaram Telegram:https://t.me/joinchat/I_f4DhGF_Zifr9YZvvMkRg LinkedIn:https://www.linkedin.com/in/hari-prasath-aa65bb19/ Facebook:https://www.facebook.com/HariPrasathdba FB Group:https://www.facebook.com/groups/894402327369506/ FB Page: https://www.facebook.com/dbahariprasath/? Twitter: https://twitter.com/hariprasathdba