Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a Ubuntu 14.04 server I am experiencing a massive hard disk activity which has no apparent justification: it comes as a burst, it lasts a few minutes and then disappears. It consumes system resources and slows down the whole system.

Is there a (command-line) tool which can be used to monitor the disk activity, listing the processes that are using the disk and the files involved? Something like htop for the CPU.

share|improve this question
    
Possible dupe - unix.stackexchange.com/q/428/4671 – Faheem Mitha Mar 3 at 22:38

For checking I/O usage I usually use iotop. It's not installed by default on the distro, but you can easily get it with:

sudo apt-get install iotop

Then launch it with root priviledges:

sudo iotop --only

The --only option will show only the processes currently accessing the I/O.

image of iotop in a terminal

share|improve this answer
5  
The --only option is really interesting because it will only show processes or threads actually doing I/O. – A.L Mar 1 at 14:29
    
@A.L good point! that's a very handy option. – fduff Mar 1 at 14:59

You can try nmon

sudo apt-get install nmon

Try:

nmon

Output Like below:

enter image description here

Press d = Disk Press c = CPU Press r = RAM Press q to exit

You can also give try with:

iostat

Output like below:

Linux 3.16.0-30-generic (client01)    03/01/2016      _i686_  (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
      39.73   24.58    2.96    0.26    0.00   32.48

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sda               3.32        57.31        40.05  119879872   83767716
sdb               1.45        15.02        22.60   31424408   47273012
share|improve this answer

Something like htop for the CPU.

atop - AT Computing's System & Process Monitor

# apt-get install -y atop
# atop

It has a similar interface to htop.

Now press shift+d - for disk activity

Then press c - for full command name..

  PID  DSK COMMAND-LINE          
28497  37% /usr/sbin/apache2 -k start
28496  36% /usr/sbin/apache2 -k start
30528  11% mplayer
..........
.....
  • shift+c - CPU
  • shift+m - Memory
  • shift+d - Disk
  • shift+n - Network (However, it may require a kernel patch)
share|improve this answer

collectl tool can also play the role of utilities that are designed with only a specific purpose such as top, ps, iotop and many others.

install:

sudo apt-get install collectl

For example the following command collectl -sc can be used to monitor the summary of the cpu usage.

The following command collectl -sd will help you to monitor the disk usage.

You can also use collectl -sD to collect data on individual disks, but you have to know that information on total disks will not be reported.

It is very easy to make collectl work as the top utility, just run the following command in your terminal collectl --top and you will see the similar output the top tool gives you when it is executed in your Linux system.

to use the collectl utility as the ps tool run the following command in your terminal:

collectl -c1 -sZ -i:1

You will get information about processes in your system the same way as you do when you run the ps command in your terminal.

you can combine the t for tcp and c for cpu example collectl -stc

the summary list of subsystems supported by the tool:

b – buddy info (memory fragmentation)
c – CPU
d – Disk
f – NFS V3 Data
i – Inode and File System
j – Interrupts
l – Lustre
m – Memory
n – Networks
s – Sockets
t – TCP
x – Interconnect
y – Slabs (system object caches)

collectl visualised through graphite or graphiti:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.