blktrace
TLDR
Trace block I/O on a device
SYNOPSIS
blktrace [options]
DESCRIPTION
blktrace is a Linux block layer I/O tracing utility that captures detailed information about block device operations. It tracks requests from submission through the I/O scheduler to completion, providing visibility into storage subsystem behavior.
The traces include information like queue insertions, merges, dispatch to driver, and completion events. Each event contains timestamp, process ID, action code, and I/O parameters (sector, size, flags).
blktrace produces binary trace files that are analyzed with blkparse, btt, or other tools. It's invaluable for diagnosing I/O performance issues, understanding workload patterns, and tuning storage configurations.
PARAMETERS
-d device
Device to trace (can specify multiple).-o file
Output file base name.-D dir
Directory for output files.-w seconds
Trace duration in seconds.-b size
Per-CPU buffer size in KB.-n num
Number of per-CPU buffers.-a action
Trace only specific actions.-A mask
Set action mask.-r relay
Use specific debugfs relay path.-I devs
Add multiple devices from file.-h
Display help.-V
Display version.
CAVEATS
Requires root privileges. Must have debugfs mounted (usually at /sys/kernel/debug). Creates binary trace files per CPU that need blkparse to read. High I/O rates can produce large trace files quickly. May impact performance on very busy systems due to trace overhead.
HISTORY
blktrace was developed by Jens Axboe and merged into the Linux kernel in version 2.6.17 (released 2006). It was created to provide detailed insight into the Linux block I/O layer, replacing older and less detailed tracing methods. The tool has become standard for storage performance analysis on Linux and is part of the blktrace package alongside blkparse and btt.


