mdflush.bt(8)
β¨ mdflush.bt β the manual, but make it a group chat β¨
okay bestie, so this is mdflush.bt from the System Manager's Manual π it traces md flush events and it runs on bpftrace/eBPF. yes, lowercase .bt, yes it's iconic.
πΈ NAME πΈ
mdflush.bt β trace md flush events, using bpftrace/eBPF. that's the whole job. she's focused. π
π SYNOPSIS π
mdflush.bt
that's it. no args, no flags, no drama. she just goes. β¨
π¦ DESCRIPTION π¦
so this tool traces flush events by md, which is the Linux multiple device driver (aka software RAID, iykyk). every time one of those flushes happens, it prints the timestamp and the md device for the flush. that's the tea. β
and why do we care?? because knowing when these flushes go down is lowkey so useful for correlating them with unexplained spikes in disk latency. like oh, your latency spiked? check the flush timing bestie, it's giving cause and effect. π₯
the way it works: it traces the kernel md_flush_request() function using kernel dynamic tracing. and no cap, because this is dynamic tracing, it will need updating to match any changes to this function. if the kernel devs touch md_flush_request(), this tool needs a glow-up. periodt. π
also important: the flushes themselves are likely to originate from higher up in the I/O stack, like from the file systems. so md is often just the messenger here, not the main character. π
β οΈ and because this uses BPF, only the root user can use this tool. no root, no vibes. π
π REQUIREMENTS π
CONFIG_BPFbpftrace
that's the whole list. get both or go home. π«Ά
π EXAMPLES π
Trace md flush events:
# mdflush.bt
slay. run it as root and watch the flushes roll in. β¨
π FIELDS π
TIMEβ when the flush event happened, formatted asHH:MM:SS.PIDβ the process ID that was on-CPU when the event was issued. this may identify the cause of the flush (like, say, the"sync"command π), but ngl it'll often just identify a kernel worker thread that was managing I/O. so don't be shocked when it's not the culprit you were hoping for.COMMβ the command name for thatPID.DEVICEβ the md device name. π
π§ OVERHEAD π§
expected to be negligible. she's light, she's polite, she barely takes up any CPU. π
π SOURCE π
this one's from bpftrace. π¦
https://github.com/iovisor/bpftrace
also β and this is the good part β go look in the bpftrace distribution for a companion _examples.txt file. it's got example usage, output, and commentary for this tool. basically the director's commentary track. obsessed. π¬
and plot twist: this is a bpftrace version of the bcc tool of the same name. the bcc tool may provide more options and customizations, so if you want extra toppings, go there:
https://github.com/iovisor/bcc
π OS π
Linux. that's the one. π§
β STABILITY β
Unstable - in development.
so like... she's still growing. be gentle. it's giving "work in progress, but make it gorgeous". π±
πΈ AUTHOR πΈ
Brendan Gregg
the icon. the legend. the moment. π
π₯ SEE ALSO π₯
and that's the whole page bestie, no notes. π this came out of USER COMMANDS, dated 2018-09-07, and yes the manual page really is named mdflush.bt(8) β so go forth, run it as root, and stan a negligible-overhead tracer. mwah. π
β¨π
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms