blktrace

blktrace is a tool to generate traces of the i/o traffic on block devices

Install the required package

yum install blktrace

mount -t debugfs none /sys/kernel/debug

Methods to use the tool

  1. blktrace /dev/sda - press Ctrl-C to terminate the blktrace program (blkparse sda.blktrace.0 will be generated in the current directory)
  2. blktrace -d /dev/sda -o - | blkparse -i -
  3. btrace /dev/sda - press Ctrl-C to terminate the blktrace program

By default, there are seven columns:

  1. Device major, minor number
  2. CPU ID
  3. Sequence number
  4. Action time, in seconds
  5. Process ID
  6. Action identifier (see below)
  7. RWBS description: may include R (read), W (write), D (block discard), B (barrier operation), S(synchronous)

Action Identifiers

A      IO was remapped to a different device
B      IO bounced
C      IO completion
D      IO issued to driver
F      IO front merged with request on queue
G      Get request
I      IO inserted onto request queue
M      IO back merged with request on queue
P      Plug request
Q      IO handled by request queue code
S      Sleep request
T      Unplug due to timeout
U      Unplug request
X      Split