Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux basic command-iostat displays the status of the device

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Iostat

The iostat instruction is used to display the cpu status, the status of the system IO device, and the related disk and NFS usage status. The iostat command monitors the system input / output device load by observing the activity time of the device relative to its average transfer rate. The iostat command generates reports that can be used to change the system configuration to better balance the input / output load between physical disks.

The first report generated by the iostat command provides statistics since the system was started, unless the-y option is used when omitting the first report. Each follow-up report covers the time since the last report. All statistics are reported each time the iostat command is run. The report consists of a CPU header row and a row after the CPU statistics row. In multiprocessor systems, CPU statistics are calculated system-wide as averages among all processors. A row of statistics for each configured device is displayed after the device title line. When the option-n is used, the NFS header line is displayed and a line of statistics is displayed for each mounted network file system.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora, SUSE, openSUSE.

1. Grammar

Iostat [options]

2. List of options

Option

Description

-c

Show cpu situation

-d

Display device utilization

-h

Use with the-n option to make the output more readable

-j

Displays the name, id, label of the specified device

-k

Display in units of "kb/s" and "blocks / s" by default

-m

In Mb/s

-N

Displays the mapped name of the registered device

-n

Show NFS statu

-p

Display block device status

-t

Show report time

-x

Display extended information

-V

Display version information and exit

-y

If multiple records are displayed within a given interval, the first report with statistics is omitted since the system started.

-z

Tell iostat to omit the output for any devices that are not active during the sample period.

3. Report

The iostat command generates three types of reports: CPU utilization reports, device usage reports, and network file system reports.

1) CPU utilization report

The first report generated by the iostat command is the CPU utilization report. For multiprocessor systems, the CPU value is the global average between all processors. The format of the report is as follows:

Report content

Description

% user

Displays the percentage of CPU utilization when executed at the user level (application).

% nice

Displays the percentage of CPU utilization when executed at the user level with good priority.

% system

Displays the percentage of CPU utilization that occurs during system-level (kernel) execution.

% iowait

Displays the percentage of time that CPU or CPU is idle, during which the system has outstanding disk Iploo requests.

% steal

Displays the percentage of time that the virtual CPU or CPU spent involuntarily waiting when the hypervisor served another virtual processor.

% idle

Displays the percentage of time that CPU or CPU is idle, and the system has no outstanding disk Icano requests.

2) equipment usage report

The second report generated by the iostat command is the device usage report. Device reports provide statistics for each physical device or partition. You can enter the block device for which you want to display statistics on the command line. If you do not use the-x option, you can also enter a partition on the command line. If there are no input devices or partitions, statistics are displayed for each device used by the system and maintenance statistics are provided for it by the kernel. If the ALL keyword is given on the command line, statistics for each device defined by the system, including devices that have never been used, are displayed. The report may display the following fields, depending on the flag used

Report content

Description

Device:

This column gives the device (or partition) name of the nth device, which is displayed in the form of devm-n, with a kernel of 2.4, where m is the main number of the device and n is a unique number. For newer kernels, the device names listed in the / dev directory are displayed.

Tps

Indicates the number of transmissions sent to the device per second. The transmission is an Ithumb O request to the device. Multiple logical requests can be combined into a single Ipicuro request to the device. The transfer is of uncertain size.

Blk_read/s

Indicates the amount of data read from the device, expressed as multiple blocks per second. The block is equivalent to the kernel 2.4 and later sectors, so its size is 512 bytes. For older cores, the size of the block is uncertain.

Blk_wrtn/s

Indicates the amount of data written to the device, expressed as multiple blocks per second.

Blk_read

Total number of blocks read

Blk_wrtn

Total number of blocks written

KB_read/s

Indicates the amount of data read from the device, expressed in kilobytes per second.

KB_wrtn/s

Indicates the amount of data written from the device, expressed in kilobytes per second.

KB_read

Total number of reads, kb

KB_wrtn

Total number of writes, kb

MB_read/s

Indicates the amount of data written to the device, expressed in megabytes per second.

MB_wrtn/s

Indicates the amount of data of the reading device, expressed in megabytes per second.

MB_read

Total number of reads, Mb

MB_wrtn

Total number of writes, Mb

Rrqm/s

The number of read requests merged into the device per second.

Wrqm/s

The number of write requests merged into the device per second.

R/s

The number of read requests made to the device per second.

W/s

The number of write requests made to the device per second.

Rsec/s

The number of sectors read from the device per second.

Wsec/s

The number of sectors written from the device per second.

RkB/s

Kilobytes read from the device per second.

WkB/s

Kilobytes written from the device per second.

RMB/s

Number of megabytes read from the device per second.

WMB/s

The number of megabytes written from the device per second.

Avgrq-sz

Average size of requests made to the device by sector

Avgqu-sz

The average queue length of requests made to the device.

Await

The average time (in milliseconds) that an Istroke O request was made to the device to be served. This includes the time the request spent in the queue and the time it took to serve them.

Svctm

The average service time (in milliseconds) for Istroke O requests made to the device. Warning! Don't trust this field anymore. This field will be deleted in a future version of sysstat.

% util

The percentage of CPU time (the bandwidth utilization of the device) that the Icano request was made to the device. When this value is close to 100%, device saturation occurs.

3) NFS report

The NetworkFilessystem (NFS) report provides statistics for each mounted network file system. The report shows the following areas:

Report content

Description

Filesystem:

This column shows the hostname of the NFS server, followed by a colon, and the name of the directory where the network file system is installed.

RBlk_nor/s

Indicates the number of blocks read by the application through the Read (2) system call interface. The block size is 512 bytes.

WBlk_nor/s

Indicates the number of blocks that the application writes by writing (2) the system call interface. The block size is 512 bytes.

RBlk_dir/s

Indicates the number of blocks read from a file opened with the O_DIRECT flag.

WBlk_dir/s

Indicates the number of blocks written to a file opened with the O_DIRECT flag.

RBlk_svr/s

Indicates the number of blocks that the NFS client requests to read from the server through the NFS read request.

WBlk_svr/s

Indicates the number of blocks written from the server by the NFS client through the NFS read request.

RkB_nor/s

Indicates the number of kilobytes read by the application through the Read (2) system call interface.

WkB_nor/s

Indicates the number of kilobytes written by the application through the write (2) system call interface.

RkB_dir/s

Indicates the number of kilobytes read from a file opened with the O_DIRECT flag.

WkB_dir/s

Indicates the number of kilobytes written to a file opened with the O_DIRECT flag.

RkB_svr/s

Indicates the number of kilobytes read from the server by the NFS client through the NFS read request.

WkB_svr/s

Indicates the number of kilobytes written from the server by the NFS client through the NFS read request.

RMB_nor/s

Indicates the number of megabytes read by the application through the Read (2) system call interface.

WMB_nor/s

Indicates the number of megabytes written by the application through the write (2) system call interface.

RMB_dir/s

Indicates the number of megabytes read from a file opened with the O_DIRECT flag.

WMB_dir/s

Indicates the number of megabytes written to a file opened with the O_DIRECT flag.

RMB_svr/s

Indicates the number of megabytes read from the server by the NFS client through the NFS read request.

WMB_svr/s

Indicates the number of megabytes written from the server by the NFS client through the NFS read request.

Ops/s

Indicates the number of operations sent to the file system per second.

Rops/s

Indicates the number of read operations sent to the file system per second.

Wops/s

Indicates the number of write operations sent to the file system per second.

4. Environmental variables

The iostat command takes into account the following environment variables:

S_TIME_FORMAT, if this variable exists and its value is ISO, the current locale is ignored when the date is printed in the report title. The iostat command uses the ISO 8601 format (YYYY-MM-DD). The timestamp displayed by option-t will also conform to the ISO 8601 format.

5. Example code

Iostat

Displays a single history since the startup report for all CPU and devices

Iostat-d 2

Display continuous device reports at two-second intervals

Iostat-d 2 6

Play the report six times every two seconds on all devices

Iostat-x hda hdb 2 6

Displays six extended statistics reports at two-second intervals for devices HDA and HDB.

Iostat-p sda 2 6

Displays six reports at two-second intervals for the device SDA and all its partitions (sda 1, etc.).

6. Examples

1) display cpu situation

[root@localhost ntop-4.0.1] # iostat-c / / only show cpu status

Linux 2.6.32-431.el6.i686 (localhost.localdomain) October 10, 2018 _ i6861CPU)

Avg-cpu:% user nice% system% iowait% steal% idle

0.17 0.00 0.11 0.04 0.00 99.68

You have new mail in / var/spool/mail/root

[root@localhost ntop-4.0.1] #

2) display nfs system status

[root@localhost ntop-4.0.1] # iostat-n-h-t / / displays the nfs status, and the time is required

Linux 2.6.32-431.el6.i686 (localhost.localdomain) October 10, 2018 _ i6861CPU)

17:34:11, October 10, 2018

Filesystem: rBlk_nor/s wBlk_nor/s rBlk_dir/s wBlk_dir/s rBlk_svr/s wBlk_svr/s ops/s rops/s wops/s

[root@localhost ntop-4.0.1] #

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report