我在eMMC上运行linux。
我想减less在设备上完成的IO。
我不喜欢在大海捞针。
我想要一种方式来跟踪对设备的访问。
我想看看写操作eMMC的进程ID和文件名。
不幸的是我到现在还找不到办法做到这一点。
我可以每秒运行一次,但是更可靠的解决scheme是值得欢迎的:
ls -ltr /proc/*/fd| grep -vE '/dev/|socket|pipe'
任何提示如何find我search的信息?
顺便说一句,我已经应用这个答案的提示: https : //raspberrypi.stackexchange.com/a/186
我使用Ubuntu 16.04
尝试sysdig 。
bash-4.1$ sysdig -l | grep write However, for some events (like writes to /dev/log) it provides evt.is_io 'true' for events that read or write to FDs, like read(), send, evt.is_io_write 'true' for events that write to FDs, like write(), send(), etc. that write to FDs, like write(). evt.is_syslog 'true' for events that are writes to /dev/log. evt.is_open_write bash-4.1$ sysdig -l | egrep 'proc.pid|fd.name' fd.name FD full name. If the fd is a file, this field contains the full proc.pid the id of the process generating the event.
所以也许是这样的:
sudo sysdig -p '%proc.pid %fd.name' evt.is_io_write exists
哎呀匹配sysdig (和我的SSH会话)。
sudo sysdig -p '%proc.pid %fd.name' \ "evt.is_io_write exists and not ( proc.name contains sysdig or proc.name contains ssh )"
还是有点忙 这在我的testing系统上更好:
sudo sysdig -p '%proc.pid %fd.name %fd.type' "evt.is_io_write exists and fd.typechar = f and not ( fd.name contains /dev or fd.name contains /proc or fd.name contains eventfd or fd.name contains signalfd or fd.name contains kvm- )"
或者你可以用path过滤fd.name然后排除/dev和/proc …