BTREPLAY(8)
π BTREPLAY β bestie edition π
okay so you wanna know about btreplay?? it's a section 8 manual page (that's the sysadmin / maintenance commands section, iykyk) and it is literally the glow-up machine for your IO workload. let's get into it β¨
β¨ NAME β¨
btreplay β recreate IO loads recorded by blktrace. that's the whole vibe, no cap π
πΈ SYNOPSIS πΈ
btreplay [ options ] <dev...>
yeah bestie, you hand it some devices and some options and it does its thing π
π¦ DESCRIPTION π¦
so btrecord and btreplay are a duo, a little iconic pair π«Ά they give you the ability to record and replay IOs that were captured by the blktrace utility. and the way they do it? they genuinely try to maintain ordering, CPU mappings, and the time-separation of IOs. maintaining the vibe, fr fr.
here's the lore: blktrace gives you the ability to collect detailed traces from the kernel for each and every IO processed by the block IO layer. these traces hand you a complete timeline for every IO processed, including all the detailed info about when an IO was first received by the block IO layer β meaning: the device, CPU number, time stamp, IO direction, sector number, and IO size (that's the number of sectors, not bytes, don't get it twisted). and with all that info? you can replay the IO again on the same machine, or on a totally different machine set up entirely. slay π
the basic operating work-flow to replay IOs is like, something like this:
- Run
blktraceto collect traces. here you specify the device or devices you wish to trace and later replay IOs upon.
Note: the only traces you're actually interested in are QUEUE requests β so to save system resources (including storage for traces), one could specify the-a queuecommand line option toblktrace. saving resources is self-care π
- While
blktraceis running, you run the workload that you're interested in. - When the work load has completed, you stop the
blktraceutility (thus saving all traces over the complete workload). - You extract the pertinent IO information from the traces saved by
blktraceusing thebtrecordutility. this will parse each trace file created byblktrace, and crafty IO descriptions to be used in the next phase of the workload processing. - Once
btrecordhas successfully created a series of data files to be processed, you can run thebtreplayutility, which attempts to generate the same IOs seen during the sample workload phase. and then it's giving... the same IOs. iconic π
π OPTIONS π
-c <num>,--cpus=<num>β set number of CPUs to use.-d <dir>,--input-directory=<dir>β set input directory. this option requires a single parameter providing the directory name for where input files are to be found. the default directory is the current directory (.). yes bestie, it just looks right where you're standing by default π-F,--find-recordsβ find record files automatically. this option instructsbtreplayto go find all the record files in the directory specified (either via the-doption, or in the default directory (.).-h,--helpβ show help and exit. the classic.-i <basename>,--input-base=<basename>β set base name for input files. every input file has 3 fields:- Device identifier (taken directly from the device name of the
blktraceoutput file). btrecordbase name β by defaultreplay.- The CPU number (again, taken directly from the
blktraceoutput file name).
- Device identifier (taken directly from the device name of the
this option requires a single parameter that will override the default name (replay), and replace it with the specified value.
-I <num>,--iterations=<num>β set number of iterations to run. this option requires a single parameter which specifies the number of times to run through the input files. the default value is1.-M <filename>,--map-devs=<filename>β specify device mappings. this option requires a single parameter which specifies the name of a file contain device mappings. the file must be very simply managed, with just two pieces of data per line:- The device name on the recorded system (with the
/dev/removed). Example:/dev/sdawould just besda. - The device name on the replay system to use (again, without the
/dev/path prepended).
- The device name on the recorded system (with the
an example file for when one would map devices /dev/sda and /dev/sdb on the recorded system to dev/sdg and sdh on the replay system would be:
sda sdg
sdb sdh
the only entries in the file that are allowed are these two element lines β we do not (yet?) support the notion of blank lines, or comment lines, or the like. so no little # diary entries in there, sorry bestie π
the utility allows for multiple -M options to be supplied on the command line.
-N,--no-stallsβ disable pre-bunch stalls. when specified on the command line, all pre-bunch stall indicators will be ignored. IOs will be replayed without inter-bunch delays. no waiting around, we're booked and busy π-x <factor>,--acc-factor=<factor>β specify acceleration factor. default value is1(no acceleration).-v,--verboseβ enable verbose output. when specified on the command line, this option instructsbtreplayto store information concerning each stall and IO operation performed bybtreplay. the name of each file so created will be the input file name used with an extension of.repappended onto it. thus, an input file of the namesdab.replay.3would generate a verbose output file with the namesdab.replay.3.repin the directory specified for input files. π
in addition, btreplay will also output to stderr the names of the input files being processed.
-V,--versionβ show version number and exit.-W,--write-enableβ enable writing during replay. as a precautionary measure, by defaultbtreplaywill not process write requests. in order to enablebtreplayto actually write to devices one must explicitly specify the-Woption.
bestie. listen. this one writes to your devices for real. it's off by default for a reason β don't just sprinkle -W on a command because it looked cute. β οΈ
π«Ά AUTHORS π«Ά
btreplay was written by Alan D. Brunelle. this man page was created from the btreplay documentation by Bas Zoetekouw. legends, both of them π
π REPORTING BUGS π
found a bug? report it to <linux-btrace@vger.kernel.org>. tell them everything, they'll handle it π
β COPYRIGHT β
Copyright Β© 2007 Alan D. Brunelle, Alan D. Brunelle and Nathan Scott.
this is free software. you may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. there is NO WARRANTY, to the extent permitted by law.
this manual page was created for Debian by Bas Zoetekouw. it was derived from the documentation provided by the authors and it may be used, distributed and modified under the terms of the GNU General Public License, version 2.
on Debian systems, the text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.
π SEE ALSO π
the full documentation for btreplay can be found in /usr/share/doc/blktrace on Debian systems.
blktrace(8)blkparse(1)btrecord(8)
okay that's the whole page, bestie, you're fully caught up πβ¨
this lil masterpiece comes from blktrace git-20071207142532, dated December 8, 2007 β vintage but still eating, no cap ππ¦π
π¦ where this page comes from
- centos-stream 10: blktrace 1.3.0-13.el10 Β· GPL-2.0-or-later
- centos-stream 9: blktrace 1.2.0-20.el9 Β· GPLv2+
- debian bookworm: blktrace 1.2.0-5 Β· GPL-2.0-or-later
- debian trixie: blktrace 1.3.0-0.2 Β· GPL-2.0-or-later
- fedora 43: blktrace 1.3.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: blktrace 1.3.0-15.fc44 Β· GPL-2.0-or-later
- nixos 26.05: blktrace 1.3.0
- nixpkgs unstable: blktrace 1.3.0
- opensuse-leap 16.0: blktrace 1.3.0+git.20211021-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: blktrace 1.3.0+git.20211021-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: blktrace 1.3.0+git.20211021-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: blktrace 1.3.0+git.20211021-160000.2.2 Β· GPL-2.0-only
- ubuntu jammy: blktrace 1.2.0-5 Β· GPL-2.0-or-later
- ubuntu noble: blktrace 1.2.0-5ubuntu2 Β· GPL-2.0-or-later
- ubuntu questing: blktrace 1.2.0-5ubuntu4
- ubuntu resolute: blktrace 1.2.0-5ubuntu5 Β· GPL-2.0-or-later
- ubuntu stonking: blktrace 1.2.0-5ubuntu5 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms