I wonder how I can monitor which process takes out all my I/O bandwith. The only command I know is gstat
but it shows cumulative info. Are there any tools I can use to inspect the running processes for their I/O usage? The system is FreeBSD 8.3.
Asked
Active
Viewed 4.0k times
16

Mateusz Piotrowski
- 8,029
- 10
- 53
- 79

Sergey Efimov
- 473
- 1
- 3
- 16
-
http://serverfault.com/questions/169676/howto-check-disk-i-o-utilisation-per-process – Ciro Santilli OurBigBook.com May 18 '16 at 12:36
-
1@CiroSantilli709大抓捕六四事件法轮功 that's a linux question. However this is more suitable: https://serverfault.com/questions/460634/identify-which-process-is-responsible-for-heavy-disk-i-o-under-freebsd – eis Jun 12 '17 at 06:52
-
@eis sure just saying it is related ;-) 99 percent of googlers will fall here for Linux however :-) – Ciro Santilli OurBigBook.com Jun 12 '17 at 07:12
4 Answers
16
The answer is to use top
then hit m to display IO percentage per process/thread.

Mateusz Piotrowski
- 8,029
- 10
- 53
- 79

Sergey Efimov
- 473
- 1
- 3
- 16
-
9What version of 'top' is this in? On mine 'm' toggles the memory usage summary. – Daniel Kitachewsky Jun 05 '13 at 09:05
-
2@DanielKitachewsky - Works on my FreeBSD: `$ top -v` gives `top: version 3.5beta12`. FreeBSD *does* use a different top than most Linux distrubitions. On my Linux boxes, 'm' toggles memory usage like you mentioned. – beatgammit Oct 22 '13 at 20:51
-
1Try `shift+m` to short by memory percentage. `shift+p` for cpu and `shift+t` for time – John Veldboom Aug 14 '14 at 13:36
9
-
1But FreeBSD doesn't (at least not in ports). I think `iotop` uses Linux's /proc, which is *not* the same on FreeBSD. – beatgammit Oct 22 '13 at 20:53
-
1I wonder why is this upvoted so much and accepted, when the tool doesn't even exist on freebsd? – eis Jun 12 '17 at 06:52
-
9THIS ANSWER DOES NOT WORK ON FREEBSD! Check out working answers below or use `top -m io -o total` – Allen Luce May 24 '18 at 00:29
3
You can use ktrace if you want to trace a single process:
$ ktrace -ti -p PID
Do read the manual for ktrace so you know how to disable ktrace before using. Something like:
$ ktrace -p PID -f debug.txt
$ ktrace -C
$ kdump -f debug.txt
kdump, since the output isn't human readable.

eis
- 51,991
- 13
- 150
- 199
-
Yes i know about ktrace but it does not display the weight of each request. – Sergey Efimov Dec 24 '12 at 13:17
-
Wait, the weight? So how about some packet sniffing programs like WireShark or Fiddler? – the_marcelo_r Dec 24 '12 at 13:35
-
1No, there is no problem with network. The weight i mean % of disk channel bandwith – Sergey Efimov Dec 24 '12 at 13:36
-
1Did you try to use vmstat and iostat to check the timeframe and disk I/O rate? `systat -iostat` `iostat -x 2` `vmstat` – the_marcelo_r Dec 24 '12 at 13:44
0
According to a quick research, for Network analysis: you can either use lsof -i
or sockstat
(http://www.freebsd.org/cgi/man.cgi?query=sockstat&sektion=1) to identify the sockets opened by specific processes, then you can use tcpdump
to check the details of that connection (http://www.thegeekstuff.com/2010/08/tcpdump-command-examples/#more-5676). You can also try trafshow
and iftop
.
For Disk I/O: on Linux I use sar -q
, there must be something similar.

the_marcelo_r
- 1,847
- 22
- 35
-
I have no problem with network, only with high I/O of disk (as seen from gstat) – Sergey Efimov Dec 24 '12 at 13:17
-
My bad, I saw "bandwidth" in your question and got confused. Here's an interesting article: http://www.bsdnewsletter.com/bsda-book/Monitor_disk_input--output.html, hope it helps. – the_marcelo_r Dec 24 '12 at 13:24
-
Did you check this other question? http://stackoverflow.com/questions/3965821/freebsd-iostat-how-to-tell-if-theres-a-problem?rq=1 – the_marcelo_r Dec 24 '12 at 13:40