---
name: "mdflush.bt"
section: "8"
platform: "linux"
package: "bpftrace"
version: "0.27.0-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mdflush.bt"
---

# mdflush.bt(8)

Trace md flush events. Uses bpftrace/eBPF.

## NAME

mdflush.bt - Trace md flush events. Uses bpftrace/eBPF.

## SYNOPSIS

**mdflush.bt**

## DESCRIPTION

This tool traces flush events by md, the Linux multiple device driver (software RAID). The timestamp and md device for the flush are printed. Knowing when these flushes happen can be useful for correlation with unexplained spikes in disk latency.

This works by tracing the kernel md\_flush\_request() function using kernel dynamic tracing, and will need updating to match any changes to this function.

Note that the flushes themselves are likely to originate from higher in the I/O stack, such as from the file systems.

Since this uses BPF, only the root user can use this tool.

## REQUIREMENTS

CONFIG\_BPF and bpftrace.

## EXAMPLES

- Trace md flush events:

  \# **mdflush.bt**

## FIELDS

- TIME

  Time of the flush event (HH:MM:SS).

- PID

  The process ID that was on-CPU when the event was issued. This may identify the cause of the flush (eg, the "sync" command), but will often identify 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.

## 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.

## AUTHOR

Brendan Gregg

## SEE ALSO

[biosnoop.bt(8)](/biosnoop.bt/8.md)
