Greetings, How does one go about tracing *physical* disk I/O on Linux? Level 1: trace physical I/O requests: "wrote 4 sectors at offset 533624 on /dev/hda1" Level 2: report/filter-by PID: "PID 256 (/bin/foo) wrote 4 sectors at offset 533624 on /dev/hda1" Level 3: map physical locations back to files: "PID 256 (/bin/foo) wrote 2048 bytes to inode 535 (/tmp/foo)" To goal is to understand and reduce disk usage on a loaded system. It would suffice to get totals per file/process over several seconds instead of per-event notification.
Level 1 requires a pretty straightforward kernel patch; some are available (but appear outdated). Totals per device can be obtained via /proc/stat or 'iostat', so one can inconveniently find totals over a subset of files by moving those files to a dedicated partition. Level 2 seems to require finding the process that last accessed a buffer block, or (easier and nearly as good) the file associated with the buffer block and some process that has that file open. Note the difficulty with memory-mapped files. Level 3 seems to require filesystem hooks or filesystem-specific code. The following post describes responses to an essentially identical question regarding Solaris, including one Level 2 solution that's Solaris-specific. http://www.netsys.com/sunmgr/1999-01/msg00027.html BTW, while searching for the above I chanced upon the following the Linux Trace Toolkit (http://www.opersys.com/LTT/), whose functionality somewhat overlaps syscalltrack -- it can trace syscalls system-wide, though it does not appear to handle syscall arguments. OTOH it can trace scheduling and context switches. Eran ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]
