Difference between revisions of "Disk usage related information"

From Notes_Wiki
m
m
Line 7: Line 7:




==iostat==
=iostat=


One can use following command:
One can use following command:
Line 16: Line 16:




==iotop==
=iotop=


Sometimes machine may be too slow and using top may indicate very high value of %wa indicating slowness due to disk I/O.  If this continues for long even load average would increase to indicate slow performance.  To figure out which processes are using more disk we can install '<tt>iotop</tt>' tool which lists processes in order of their disk usage.   
Sometimes machine may be too slow and using top may indicate very high value of %wa indicating slowness due to disk I/O.  If this continues for long even load average would increase to indicate slow performance.  To figure out which processes are using more disk we can install '<tt>iotop</tt>' tool which lists processes in order of their disk usage.   
Line 26: Line 26:




==atop==
=atop=


Atop is a more comprehensive monitoring tool.  It looks at CPU, RAM, hdd, etc. all parameters while monitoring.  This can be useful if combination of various parameters need to be monitored using same tool.  To start atop use:
Atop is a more comprehensive monitoring tool.  It looks at CPU, RAM, hdd, etc. all parameters while monitoring.  This can be useful if combination of various parameters need to be monitored using same tool.  To start atop use:
Line 33: Line 33:
</pre>
</pre>


==Using atop for system activity recording similar to sar==
Atop can also be used to record activity at regular intervals.  Compared to sar this will give a very detailed record of all processes including their memory, disk, etc. utilization.  To run atop in background we can use:
<pre>
nohup atop -w /opt/atop.raw 300
</pre>
The above command will record atop values in the file every 300 seconds. 
Once the file is available we can view it via:
<pre>
atop -r /opt/atop.raw
</pre>
To go to next interval in the file use 't'.  To go to previous interval in raw file use 'T'.
==Atop keyboard shortcuts==
; g : Show general output (Default)
; m : Show memory related output
; d : Show disk related output
; n : Show network related output (Did not work in Rocky due to missing netatop kernel module)
; s : Show scheduling characteristics.
; v : Show various process characteristics.
; c : Show the command line of the process.
; e : Show GPU utilization.
; y : Show the individual threads within a process (toggle).
; Y : Sort the threads per process when combined with option 'y' (toggle).
; u : Show the process activity accumulated per user.
; p : Show the process activity accumulated per program (i.e. process name).
; j : Show the process activity accumulated per Docker container.
; C : Sort the current list in the order of cpu consumption (default).  The one-but-last column changes to ``CPU''.
; E : Sort the current list in the order of GPU utilization
; M : Sort  the  current list in the order of resident memory consumption. 
; D : Sort the current list in the order of disk accesses issued. 
; N : Sort the current list in the order of network bandwidth (received and transmitted). 
; A : Sort the current list automatically in the order of the most busy system resource during this interval.
; z : Pause periodic refresh as per interval
; i : Modify  the  interval timer (default: 10 seconds). If an interval timer of 0 is entered, the interval timer is switched off. In that case a new sample can only be triggered manually by pressing the key 't'.
; b : When  viewing  the  contents  of  a  raw  file, this key can be used to branch to a certain timestamp within the file either forward or backward.
; U : Specify a search string for specific user names as a regular expression. 
; I : Specify a list with one or more PIDs to be selected.
; P : Specify a search string for specific process names as a regular expression.
; / : Specify  a  specific command line search string as a regular expression. \
; J : Specify a Docker container id of 12 (hexadecimal) characters.
; Q : Specify  a  comma-separated  list  of process/thread state characters.  From now on, only processes/threads will be shown that are in those specific states.  Accepted states are: R (running), S (sleeping), D (disk sleep), I (idle), T (stopped), t (tracing stop), X (dead), Z (zombie) and P (parked).
; S : Specify search strings for specific logical volume names, specific disk names and specific network interface names.
Go through '<tt>man atop</tt>' for considerable more detail than listed above.


[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Information tools]] > [[Disk usage related information]]
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Information tools]] > [[Disk usage related information]]

Revision as of 04:37, 6 May 2023

Home > CentOS > CentOS 6.x > Information tools > Disk usage related information

If the performance of a system is poor, then the most common reasons for poor performance are high usage of CPU, memory, network or disk. CPU usage can be monitored using top or htop, memory usage can be seen using free -m or top, network usage can be seen using iptraf, tcptrack, etc. Similalry for disk usage one can use:

  1. iostat
  2. iotop
  3. atop


iostat

One can use following command:

iostat 5

to see disk usage in last five seconds to see if disk usage is very high. The first set of values printed are cumulative till the command was run, so they should be ignored. Second set of values onwards can be used for actual diagnosis.


iotop

Sometimes machine may be too slow and using top may indicate very high value of %wa indicating slowness due to disk I/O. If this continues for long even load average would increase to indicate slow performance. To figure out which processes are using more disk we can install 'iotop' tool which lists processes in order of their disk usage.

To see top like listing of processes but in terms of their disk usage and not CPU, one can use:

iotop


atop

Atop is a more comprehensive monitoring tool. It looks at CPU, RAM, hdd, etc. all parameters while monitoring. This can be useful if combination of various parameters need to be monitored using same tool. To start atop use:

atop


Using atop for system activity recording similar to sar

Atop can also be used to record activity at regular intervals. Compared to sar this will give a very detailed record of all processes including their memory, disk, etc. utilization. To run atop in background we can use:

nohup atop -w /opt/atop.raw 300 

The above command will record atop values in the file every 300 seconds.

Once the file is available we can view it via:

atop -r /opt/atop.raw

To go to next interval in the file use 't'. To go to previous interval in raw file use 'T'.


Atop keyboard shortcuts

g
Show general output (Default)
m
Show memory related output
d
Show disk related output
n
Show network related output (Did not work in Rocky due to missing netatop kernel module)
s
Show scheduling characteristics.
v
Show various process characteristics.
c
Show the command line of the process.
e
Show GPU utilization.
y
Show the individual threads within a process (toggle).
Y
Sort the threads per process when combined with option 'y' (toggle).
u
Show the process activity accumulated per user.
p
Show the process activity accumulated per program (i.e. process name).
j
Show the process activity accumulated per Docker container.
C
Sort the current list in the order of cpu consumption (default). The one-but-last column changes to ``CPU.
E
Sort the current list in the order of GPU utilization
M
Sort the current list in the order of resident memory consumption.
D
Sort the current list in the order of disk accesses issued.
N
Sort the current list in the order of network bandwidth (received and transmitted).
A
Sort the current list automatically in the order of the most busy system resource during this interval.
z
Pause periodic refresh as per interval
i
Modify the interval timer (default: 10 seconds). If an interval timer of 0 is entered, the interval timer is switched off. In that case a new sample can only be triggered manually by pressing the key 't'.
b
When viewing the contents of a raw file, this key can be used to branch to a certain timestamp within the file either forward or backward.
U
Specify a search string for specific user names as a regular expression.
I
Specify a list with one or more PIDs to be selected.
P
Specify a search string for specific process names as a regular expression.
/
Specify a specific command line search string as a regular expression. \
J
Specify a Docker container id of 12 (hexadecimal) characters.
Q
Specify a comma-separated list of process/thread state characters. From now on, only processes/threads will be shown that are in those specific states. Accepted states are: R (running), S (sleeping), D (disk sleep), I (idle), T (stopped), t (tracing stop), X (dead), Z (zombie) and P (parked).
S
Specify search strings for specific logical volume names, specific disk names and specific network interface names.

Go through 'man atop' for considerable more detail than listed above.

Home > CentOS > CentOS 6.x > Information tools > Disk usage related information