A tcpdump-like tool for disk I/O?

Hi, can anyone please suggest a tool to dump i/o packets just like tcpdump does for network traffic. Basically I have a complex dataflow that needs to be optimized and I want to see how packets go to/from disk - what goes randomly and sequentially.

Thanks

have you checked the iostat command? here is a man page.

in ubuntu, iostat is part of the sysstat package under synaptic

Yogesh, thanks for your reply. Afaik iostat and the like (sar, vmstat, ...) only report statistics, but do not dump i/o packets (pls let me know if i'm wrong). Of course you can do something like (number-of-io-bytes)/(number-of-io-request) and get a geenral idea of io ratio. However this kind of analysis cannot answer the questions like - am i accessing a file in the most efficient manner, or do I have unnecessary random seeks, etc...

I'm not sure how useful this information would be without direct I/O. Reordering, read-ahead, commit intervals, and plentiful cache can permit a variety of poor I/O practices to run almost optimally, not to mention make correlating I/O with software a headache -- it becomes so random it's used as seed for the system's "secure" RNG.

well, w/o seeing data access paths it's hard to say whether data access patterns are optimal or close to optimal and make any decisions regarding direct i/o. next, lets assume i decided to implement direct i/o - how do i tell whether my implementation is the optimal one. my case not about comparison or achieving certain kbps, it rather about getting best from disk.

Assuming raw I/O, I'd use strace and grep for read and write calls to the appropriate FD.

Corona688, thanks for your input. But I think you agree with me that that's not exaclty it. With strace I cannot see how exactly read/write API calls are mapped into block devide requests, next - a very important one - I cannot see how efficiently I utilize FS. For example on some filesystems I have to allocate file in large chunks and then fseek, on others I have to append, so on... - all these choises become obvious once I can see what's going on under the hood...

PS
I think once I found a tool that did exactly what I need by installing a driver under /proc but now I can't find it anymore...

was it dtrace or systap?

definitely not dtrace as this was linux :slight_smile: i never heard of systap before, can you provide a link please because google is useless... but i think i found something:

Manpage of IOTRACE

haven't tried it yet though...