Skip to content


linux查看io状态脚本

#查看占用io的进程

ps -eo pid,user,wchan=WIDE-WCHAN-COLUMN -o s,cmd|awk ‘ $4 ~ /D/ {print $0}’
#进程打开的文件
lsof -p $pid

使用block_dump

/etc/init.d/syslog stop
echo 1 > /proc/sys/vm/block_dump
sleep 60
dmesg | awk ‘/(READ|WRITE|dirtied)/ {process[$1]++} END {for (x in process) \
print process[x],x}’ |sort -nr |awk ‘{print $2 ” ” $1}’ | \
head -n 10
echo 0 > /proc/sys/vm/block_dump
/etc/init.d/syslog start

以下为结果

Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
kjournald(1860): 1156
pdflush(78): 716
kjournald(1861): 130
nginx(13571): 88
rm(21542): 85
find(21540): 67
nginx(13568): 65
nginx(13570): 41
php-cgi(13612): 37
nginx(13566): 34
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]

脚本下载
block_dump

Posted in shell, 技术.

Tagged with , , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.