• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

iostat Command Examples in Linux

by admin

The iostat utility generates reports on CPU and device usage. For storage, it provides input and output statistics for block devices and partitions. Using the -d option to specify device information only, the iostat command lists the following statistics for each storage device:

  • Transfers (I/O requests) per second (tps).
  • Number of blocks read per second (kB_read/s).
  • Number of blocks written per second (kB_wrtn/s).
  • The total number of blocks read (kB_read).
  • The total number of blocks written (kB_wrtn).

You can use this report to monitor how a storage drive is being used and to identify any potential bottlenecks. For example, a faulty drive might have lower reads and/or writes per second than expected. You can also use the report to help you decide how to best distribute I/O load between the available devices.

Syntax

The syntax of the iostat command is:

# iostat [options] [device names]

Displaying storage device usage statistics.

iostat command examples in Linux

iostat Configuration files

  • /proc/stat – It contains system statistics.
  • /proc/uptime – It contains system uptime.
  • /proc/partitions – It contains disk statistics (for pre 2.5 kernels that have been patched).
  • /proc/diskstats – It contains disks statistics (for post 2.5 kernels).
  • /sys – It contains statistics for block devices (post 2.5 kernels).
  • /proc/self/mountstats – It contains statistics for network filesystems.

iostat Command Examples

1. To get the CPU utilization:

# iostat -c
# iostat -c 2 10 (With delay of 2 seconds and 10 iterations)

2. To get the device utilization:

# iostat -d
# iostat -d 2 10         (With delay of 2 seconds and 10 iterations) 

3. To display the human readable NFS IO stats:

# iostat -nh
# iostat -n -h 2 10         (With delay of 2 seconds and 10 iterations)

4. To display the stats in kilo bytes instead of bytes/second:

# iostat -k 
# iostat -k 2 10         (With delay of 2 seconds and 10 iterations)

5. To display the stats in mega bytes instead of bytes/second:

# iostat -m 
# iostat -m 2 10         (With delay of 2 seconds and 10 iterations)

6. To display the registered device mapper names:

# iostat -N 
# iostat -N 2 10         (With delay of 2 seconds and 10 iterations)

7. To display the NFS reports:

# iostat -n 
# iostat -n 2 10         (With delay of 2 seconds and 10 iterations)

8. To display the stats for block devices and their partitions:

# iostat -p 
# iostat -p 2 10         (With delay of 2 seconds and 10 iterations)

9. To get the time for each report displayed:

# iostat -t 
# iostat -t 2 10         (With delay of 2 seconds and 10 iterations)

10. To get the version number:

# iostat -V 
# iostat -V 2 10         (With delay of 2 seconds and 10 iterations)

11. To display the extended statistics:

# iostat -x
# iostat -x sda
# iostat -x sda 2 5         (With delay of 2 seconds and 10 iterations)

12. To tell iostat to omit the output:

# iostat -z 
# iostat -z 2 10         (With delay of 2 seconds and 10 iterations)

Filed Under: Linux

Some more articles you might also be interested in …

  1. TCP Wrapper (hosts.allow & hosts.deny) Command Options in Linux
  2. How to change the Default Log Directory(/var/log) in Rsyslog for CentOS/RHEL 6,7
  3. a2query: command not found
  4. What happens in the Background when you execute the “useradd” command under Linux
  5. How to Check Swap Usage Live via the ‘top’ Command in Linux
  6. df Command Examples in Linux
  7. kubectl: command not found
  8. tvservice: command not found
  9. userdel Command Examples in Linux
  10. How to fix the error “host key verification failed”

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright