blktrace command examples
blktrace – generate traces of the i/o traffic on block devices
To trace the i/o on the device /dev/hda and parse the output to human readable form, use the following command:
% blktrace -d /dev/sda -o - | blkparse -i -
This same behaviour can be achieve with the convenience script btrace. The command
% btrace /dev/sda
has exactly the same effect as the previous command. See btrace (8) for more information.
To trace the i/o on a device and save the output for later processing with blkparse, use blktrace like this:
% blktrace /dev/sda /dev/sdb
This will trace i/o on the devices /dev/sda and /dev/sdb and save the recorded information in the files sda and sdb in the current directory, for the two different devices, respectively. This trace information can later be parsed by the blkparse utility:
% blkparse sda sdb
which will output the previously recorded tracing information in human readable form to stdout.