mdflush.bt(8)
β¨ mdflush.bt π β Trace md flush events π
okay so mdflush.bt is a bpftrace/eBPF tool that traces md flush events π«Ά "md" is the Linux multiple device driver, aka software RAID π
Every time it flushes, you get the timestamp and the md device printed right there. Lowkey super useful for correlating those mysterious spikes in disk latency π bestie, knowing when the flushes happen is everything π
πΈ SYNOPSIS πΈ
mdflush.bt
π¦ DESCRIPTION π¦
So this tool traces flush events by md, the Linux multiple device driver (software RAID) β¨ It prints the timestamp and the md device for each flush. Knowing when these flushes happen can be seriously helpful when you're trying to match them up with unexplained spikes in disk latency π₯
Here's the tea: it works by tracing the kernel md_flush_request() function using kernel dynamic tracing π§ That means it'll need updating if anything changes in that function, so keep that in mind π
Also, be aware that the flushes themselves are likely coming from higher up in the I/O stack, like from the file systems π not the tool, not md, just the vibes from upstream.
Since this uses BPF, only the root user can use this tool. Main character energy is cute, but you need to be root π
π REQUIREMENTS π
You need CONFIG_BPF and bpftrace π
π EXAMPLES π
Trace md flush events:
# mdflush.bt
π FIELDS π
TIMEβ Time of the flush event, formatted asHH:MM:SSβ°PIDβ The process ID that was on-CPU when the event was issued. This can identify the cause of the flush (eg, thesynccommand), but it'll often point to a kernel worker thread that was managing I/O π§΅COMMβ The command name for the PID π·οΈDEVICEβ The md device name πΎ
π OVERHEAD π
Expected to be negligible β¨ basically no drama on performance π«Ά
π¦ SOURCE π¦
This is from bpftrace π
https://github.com/bpftrace/bpftrace
Also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool π
This is a bpftrace version of the bcc tool of the same name. The bcc tool may provide more options and customizations π§
https://github.com/iovisor/bcc
π§ OS π§
Linux π§
πΈ STABILITY πΈ
Unstable - in development π§ so it's still cooking, bestie π³
π AUTHOR π
Brendan Gregg π
π SEE ALSO π
biosnoop.bt(8) π«Ά
mdflush.bt(8) is from the USER COMMANDS section, last updated 2018-09-07 π Stay iconic, bestie πβ¨
π¦ where this page comes from
- alpine 3.24: bpftrace-tools-doc 0.26.1-r0 Β· Apache-2.0
- arch rolling: bpftrace 0.27.0-2 Β· Apache-2.0
- centos-stream 10: bpftrace 0.26.1-1.el10 Β· Apache-2.0
- centos-stream 9: bpftrace 0.26.1-1.el9 Β· ASL 2.0
- debian trixie: bpftrace 0.23.2-1 Β· Apache-2.0
- fedora 43: bpftrace 0.24.0-1.fc43 Β· Apache-2.0
- fedora 43: bpftrace 0.24.2-1.fc43 Β· Apache-2.0
- fedora 44: bpftrace 0.24.2-3.fc44 Β· Apache-2.0
- nixos 26.05: bpftrace 0.25.1
- nixpkgs unstable: bpftrace 0.27.1
- opensuse-leap 16.0: bpftrace-tools 0.23.5-160000.1.2 Β· Apache-2.0
- ubuntu questing: bpftrace 0.23.5-1ubuntu1 Β· Apache-2.0
- ubuntu resolute: bpftrace 0.25.0-1ubuntu1 Β· Apache-2.0
- ubuntu stonking: bpftrace 0.25.0-1ubuntu2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms