리눅스 기초 다지기 - 31. iostat

 

iostat

: 디스크 입출력 통계정보 확인

 

[root@localhost ~]# yum -y install sysstat

 

옵션

 

-c

: CPU 정보 출력

 

-d

: 디스크 장치의 입출력 정보 출력

 

-p

: /dev/장치명, 지정된 디스크 장치의 정보를 출력

 

-k

: kb 단위

 

-m

: mb 단위

 

-x

: 확장된 통계 정보(Display Extended Statistics)

 

CPU Utilization Report

 

%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

 

# CPU 정보 출력
[root@localhost logs]# iostat -c
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/29/23        _x86_64_        (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.53    0.01    0.78    0.21    0.00   98.47

# CPU 정보 출력 -> 1초 간격으로 3번 
[root@localhost logs]# iostat -c 1 3
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/29/23        _x86_64_        (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.53    0.01    0.78    0.21    0.00   98.47

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.50    0.00    1.00    0.00    0.00   98.51

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    0.00    0.00    0.00    0.00  100.00

 

Device Utilization Report

 

tps

: Indicate the number of transfers per second that were issued to the device. A transfer is an I/O request to the device. Multiple logical re‐quests can be combined into a single I/O request to the device. A transfer is of indeterminate size

 

Blk_read/s (kB_read/s, MB_read/s)

: Indicate the amount of data read from the device expressed in a number of blocks (kilobytes, megabytes) per second. Blocks are equivalent to sectors and therefore have a size of 512 bytes

 

Blk_wrtn/s (kB_wrtn/s, MB_wrtn/s)

: Indicate the amount of data written to the device expressed in a number of blocks (kilobytes, megabytes) per second

 

Blk_dscd/s (kB_dscd/s, MB_dscd/s)

: Indicate the amount of data discarded for the device expressed in a number of blocks (kilobytes, megabytes) per second

 

Blk_w+d/s (kB_w+d/s, MB_w+d/s)

: Indicate the amount of data written to or discarded for the device expressed in a number of blocks (kilobytes, megabytes) per second

 

Blk_read (kB_read, MB_read)

: The total number of blocks (kilobytes, megabytes) read

 

Blk_wrtn (kB_wrtn, MB_wrtn)

: The total number of blocks (kilobytes, megabytes) written

 

Blk_dscd (kB_dscd, MB_dscd)

: The total number of blocks (kilobytes, megabytes) discarded

 

Blk_w+d (kB_w+d, MB_w+d)

: The total number of blocks (kilobytes, megabytes) written or discarded

 

[root@localhost logs]# iostat -d
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/29/23        _x86_64_        (2 CPU)

Device             tps    kB_read/s    kB_wrtn/s    kB_dscd/s    kB_read    kB_wrtn    kB_dscd
dm-0              3.38         0.63        33.37         0.00    2714802  144300100          0
dm-1              0.03         0.00         0.11         0.00      20188     466212          0
sda               3.14         0.65        33.48         0.00    2790284  144768430          0
sr0               0.00         0.18         0.00         0.00     798566          0          0

 

 

/dev/sda 디바이스 정보 확인

[root@localhost logs]# iostat -p /dev/sda
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/29/23        _x86_64_        (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.53    0.01    0.78    0.21    0.00   98.47

Device             tps    kB_read/s    kB_wrtn/s    kB_dscd/s    kB_read    kB_wrtn    kB_dscd
sda               3.14         0.65        33.47         0.00    2790768  144775935          0
sda1              0.00         0.01         0.00         0.00      51953       2118          0
sda2              3.14         0.63        33.47         0.00    2737458  144773816          0

# mb 단위로 출력
[root@localhost logs]# iostat -p /dev/sda -m
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/29/23        _x86_64_        (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.53    0.01    0.78    0.21    0.00   98.47

Device             tps    MB_read/s    MB_wrtn/s    MB_dscd/s    MB_read    MB_wrtn    MB_dscd
sda               3.14         0.00         0.03         0.00       2725     141383          0
sda1              0.00         0.00         0.00         0.00         50          2          0
sda2              3.14         0.00         0.03         0.00       2673     141381          0