# How can i know which process is writing hard disk intensively ?



## sw2wolf (Nov 25, 2010)

The HD lights of my box is flickering incessantly.


----------



## phoenix (Nov 25, 2010)

Run top() and swith to the I/O mode (press *m* once it's running).


----------



## sw2wolf (Nov 25, 2010)

phoenix said:
			
		

> Run top() and swith to the I/O mode (press *m* once it's running).


The following is top's output:


```
last pid:  1560;  load averages:  0.25,  0.29,  0.33                                                                 up 0+05:15:15  12:36:51
86 processes:  1 running, 85 sleeping
CPU:  2.4% user,  0.0% nice, 12.2% system,  0.6% interrupt, 84.8% idle
Mem: 108M Active, 30M Inact, 310M Wired, 17M Cache, 58M Buf, 12M Free
Swap: 903M Total, 178M Used, 725M Free, 19% Inuse, 4K In

  PID USERNAME     VCSW  IVCSW   READ  WRITE  FAULT  TOTAL PERCENT COMMAND
 1038 zaxis       938    182      0      0      0      0   0.00% VirtualBox
  818 root          866     72      0      0      0      0   0.00% Xorg
 1015 zaxis       189     17      0      0      1      1  50.00% roxterm
 1041 zaxis        14      3      0      0      0      0   0.00% opera
  999 root            9      1      0      0      0      0   0.00% hald-addon-storage
 1036 zaxis         7      0      0      0      0      0   0.00% VBoxSVC
  964 haldaemon       2      0      0      0      0      0   0.00% hald
 1003 zaxis         3      0      0      0      0      0   0.00% openbox
 1018 zaxis         3      0      0      0      0      0   0.00% fcitx
  805 root            1      0      0      0      0      0   0.00% slim
 1210 zaxis         0      0      0      0      0      0   0.00% vim
```
It seems there is no process abnormal. However, the light is always flickering ! Maybe i need more memory for less swapping ?


----------



## phoenix (Nov 25, 2010)

What's roxterm doing that's using 50% I/O?


----------



## sw2wolf (Nov 25, 2010)

phoenix said:
			
		

> What's roxterm doing that's using 50% I/O?


nothing else but running `top`


----------



## DutchDaemon (Nov 25, 2010)

That's an unhealthy percentage. Roxterm running nothing other than top shouldn't even use 0,10%. And 178M swap in use is pretty much as well. Looks like something's stuck in a loop.


----------



## serhiy (Nov 25, 2010)

and if with keys -S and -H
top -SH
and then press m

how near the {swapper} ?


----------



## sw2wolf (Nov 26, 2010)

the `top -SH ` outputs:


```
last pid:  1145;  load averages:  0.09,  0.11,  0.08                                                                 up 0+00:42:45  08:00:33
140 processes: 3 running, 119 sleeping, 18 waiting
CPU:  0.4% user,  0.0% nice,  2.8% system,  0.4% interrupt, 96.4% idle
Mem: 129M Active, 27M Inact, 302M Wired, 17M Cache, 58M Buf, 2808K Free
Swap: 903M Total, 154M Used, 749M Free, 17% Inuse

  PID USERNAME   PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
   11 root       171 ki31     0K    16K CPU1    1  39:22 100.00% {idle: cpu1}
   11 root       171 ki31     0K    16K RUN     0  38:37 97.17% {idle: cpu0}
 1040 zaxis     46    0   404M   226M IPRT E  0   2:54  3.56% {VirtualBox}
 1055 zaxis     44    0   276M   108M select  0   1:53  0.00% {initial thread}
  818 root        44    0 77268K  8064K select  1   0:37  0.00% Xorg
    0 root        76    0     0K    56K sched   0   0:30  0.00% {[color="Red"]swapper[/color]}
   12 root       -80    -     0K   144K WAIT    1   0:09  0.00% {irq16: vgapci0}
   12 root       -80    -     0K   144K WAIT    1   0:07  0.00% {irq256: hdac0}
   12 root       -32    -     0K   144K WAIT    1   0:06  0.00% {swi4: clock}
 1020 zaxis     44    0 55816K 21532K select  0   0:03  0.00% {fcitx}
 1040 zaxis     44    0   404M   226M select  1   0:02  0.00% {initial thread}
...
```


----------



## Galactic_Dominator (Nov 26, 2010)

If you are using ZFS, top io mode doesn't properly display stats.  You need this patch to be able to see ZFS writes:

http://people.freebsd.org/~avg/zfs-ru.diff

I think there's ZFS internals not properly represented even after the patch, but at least you'd be able to see standard file based writes.


----------



## chrcol (Nov 26, 2010)

Galactic_Dominator said:
			
		

> If you are using ZFS, top io mode doesn't properly display stats.  You need this patch to be able to see ZFS writes:
> 
> http://people.freebsd.org/~avg/zfs-ru.diff
> 
> I think there's ZFS internals not properly represented even after the patch, but at least you'd be able to see standard file based writes.



is this patch merged in STABLE?


----------



## Galactic_Dominator (Nov 26, 2010)

The culprit is most likely hald-addon-storage which will poll removable media devices every 2 seconds.  You can run something like `# hal-disable-polling --device /dev/cd0` to eliminate the blinks, but you'd lose what hal functionality that provides.


----------



## sw2wolf (Nov 28, 2010)

Galactic_Dominator said:
			
		

> The culprit is most likely hald-addon-storage which will poll removable media devices every 2 seconds.  You can run something like `# hal-disable-polling --device /dev/cd0` to eliminate the blinks, but you'd lose what hal functionality that provides.



Thanks! it makes great help!  The blinking frequence is decreasing very much. Do i need disable polling of USB media ?
BTW, how can i make [cmd=]hal-disable-polling --device /dev/cd0[/cmd] start automatically?


----------



## Beastie (Nov 28, 2010)

sw2wolf said:
			
		

> BTW, how can i make `hal-disable-polling --device /dev/cd0` start automatically ?


Once you run this command, polling will be disabled permanently. Though I have disabled HAL completely a long time ago, so I may be wrong.


----------

