5

I understand that each mounted ext3 filesystem will have a corresponding kjournald process running. One of those processes is using lots of CPU, and I'd like to know which filesystem is responsible.

I have three ext3 filesystems mounted, but the processes appear only as

root       325     2  0 Sep23 ?        00:30:12 [kjournald]
root      7433     2  0 Sep23 ?        00:00:00 [kjournald]
root      7434     2  0 Sep23 ?        00:09:47 [kjournald]

How can I determine which process is associated with which filesystem?

Flup
  • 7,688
  • 1
  • 31
  • 43
  • 2
    That I don't know. But `iostat` will give you a breakdown of IO per file-system and `iotop` allows for even more detailed IO monitoring. – HBruijn Dec 04 '14 at 12:57
  • My problem is that `iostat` tells me what's busy but not why; `iotop` tells me what processes are doing I/O but not on which devices; `atop` displays both those things but doesn't let me correlate them. – Flup Dec 04 '14 at 13:52
  • 1
    Hence my lack of real answer. For Linux performance monitoring/tuning/debugging and remembering which tools to apply where http://www.brendangregg.com/linuxperf.html is a good one to bookmark. [iosnoop](http://www.brendangregg.com/blog/2014-07-16/iosnoop-for-linux.html) may be of interest. – HBruijn Dec 04 '14 at 14:04

1 Answers1

1

An indirect way to do this is to use blktrace and its convenience command btrace. blktrace records and displays block-level access to disks as it happens. btrace means you don't have to remember all the options to blktrace.

# btrace /dev/sda1 | grep kjournald
  8,1    5        1     0.000201850   325  Q  WS 451573976 + 8 [kjournald]
  8,1    5        2     0.000393849   325  Q  WS 976637584 + 8 [kjournald]
  8,1    5        3     0.000398641   325  Q  WS 976637592 + 8 [kjournald]
  8,1    5        4     0.000401003   325  Q  WS 976637600 + 8 [kjournald]
  8,1    5        5     0.000404179   325  Q  WS 976637608 + 8 [kjournald]
  8,1    5        6     0.000407446   325  Q  WS 976637616 + 8 [kjournald]
                                      ^^^
                                      pid of kjournald for /dev/sda1

The fields displayed here are documented in the blkparse manpage; the fifth field is the PID of the process doing the I/O. So although I don't have a way of directly relating kjournalds to filesystems, I can see which process is associated with a specific block device and then look at the mount table to see which filesystem is implicated.

Flup
  • 7,688
  • 1
  • 31
  • 43