Capturing and Replaying Block Traces – blktrace, btrecord, btreplay and fio

Hi All,

This is neto from Brazil

How are you?

Here you have a quick tutorial how to take and replay block traces.

1) Check for entries in /sys/kernel/debug. If it is empty, please do:

mount -t debugfs nodev /sys/kernel/debug

2) Generate some IO:

dd if=/dev/dm-13 of=/dev/null bs=65536 iflag=direct

3) Capturing the trace:

cd traces
blktrace /dev/dm-13

4) From another windows, please send kill -15 to blktrace PID

We can use either btreplay or fio to replay the traces. Be careful, that fio replay test does writes and it is destructive to the target device.

Example with btreplay:

1) Convert to replay files:

cd  traces
btrecord -F

2) Replay the trace file

cd traces
btreplay -F -v -N /dev/dm-13

If you want to remap to a different disk device, create a file called newdisk.txt (e.g. dm-13 dm-15) and use:

cd traces
btreplay -M newdisk.txt -F -v -N

Example with fio:

1) Converting traces to blkparse format:

blkparse -i /root/traces/dm-13.blktrace.0 -o /dev/null -d /root/traces/dm-13-fio-trace

2) Using fio to replay:

fio –name=replay –filename=/dev/dm-13 –direct=1 –read_iolog=/root/traces/dm-13-fio-trace –replay_no_stall=1 –replay_redirect=/dev/dm-13

I will keep doing more tests and will post more updates soon.

Thank you very much for reading.

All the best

NetApp – I love this company!

This entry was posted in NetApp, Performance, workload tools and tagged , , . Bookmark the permalink.

3 Responses to Capturing and Replaying Block Traces – blktrace, btrecord, btreplay and fio

  1. Pingback: How to use blktrace, btrecord, btreplay  -

  2. Eyal Rif says:

    Hi Neto,

    While replaying the blktrace what is the data that is written ? is this the exact data written while blktrace was running , random data or a constant value (0,1..) ?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s