1

I wan't to trace I/O block device requests using blktrace command. To make a simple I/O block request I used the command below.

$ sudo dd if=/dev/sda bs=1k of=/dev/null count=1 iflag=direct &
[1] 17588
1+0 records out
1024 bytes (1.0 kB) copied, 0.0567514 s, 18.0 kB/s

As the terminal says the PID is 17588. But when I explored the blktrace the pid that request I/O device was something else, here 17592.

$ sudo blktrace -d /dev/sda -o -| blkparse -i -
8,0    2        1     0.000000000 17592  Q   R 0 + 2 [dd]
8,0    2        2     0.000003858 17592  G   R 0 + 2 [dd]
8,0    2        3     0.000005219 17592  P   N [dd]
8,0    2        4     0.000006922 17592  I   R 0 + 2 [dd]
8,0    2        5     0.000008121 17592  U   N [dd] 1
8,0    2        6     0.000009415 17592  D   R 0 + 2 [dd]

P.S: blkparse outputs format is like this:

major,minor cpu sequence timestamp pid action rwbs offset + size [process_name]
Mehrshad
  • 282
  • 1
  • 2
  • 10
  • The process ID that blktrace is showing is most probably a kernel worker thread rather than the dd process. Run dd again and you will see that the busy process is a [kworker/*] kernel thread. – Colin Ian King Sep 22 '16 at 15:56
  • @ColinIanKing How can I get PID of the kernel worker thread from dd process PID. – Mehrshad Sep 22 '16 at 16:11
  • 1
    the PID is the one showing up on blkparse, on your example it was 17592, so one would do: ps -ef | grep 17592 – Colin Ian King Sep 22 '16 at 17:09

0 Answers0