21

This question already has an answer here:

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.

marked as duplicate by Ciro Santilli 新疆改造中心996ICU六四事件, Archemar, Wouter Verhelst, elbarna, Dmitry Grigoryev Mar 19 '18 at 8:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Possible dupe - unix.stackexchange.com/q/428/4671 – Faheem Mitha Mar 3 '16 at 22:38
  • Did you resolve your issue? I'm experiencing the same thing with several ubuntu 14.04 virtualized servers and I just can't find the cause. – pakman Apr 4 '17 at 16:54
  • @pakman Yes, I solved. There were two processes that are well-known to produce such an amount of activity on Ubuntu. If I remember correctly, one of them is gvfsd-metadata and the other one has a similar name (anyway, I'm not sure about the names: try googling to get more details about them). They continuously explore the filesystem to collect information about files: if they are not necessary for your systems, there is a way to disable their execution. – BowPark Apr 5 '17 at 10:10
21

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

  • 5
    The --only option is really interesting because it will only show processes or threads actually doing I/O. – A.L Mar 1 '16 at 14:29
  • @A.L good point! that's a very handy option. – fduff Mar 1 '16 at 14:59
  • This doesn't show some processes for some reason. My HDD is maxing out at ~150MB/s according to nmon and iotop shows no processes except for periodic blips of a few KB/s – Douglas Gaskell Aug 8 '18 at 20:16
  • @DouglasGaskell any idea which process is accessing your HDD at that rate? iotop has to be launched with sudo, so it should see all processes accessing the HDD from all users. – fduff Aug 9 '18 at 6:22
12

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
4

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)
2

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

  • 1
    Would you mind to provide instructions on how to use collectl visualised through graphite or graphiti? Seems cool! – KcFnMi Jul 16 '17 at 15:44

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