pt-diskstats - Aggregate and summarize /proc/diskstats.


Usage: pt-diskstats [OPTIONS] [FILES]

pt-diskstats reads /proc/diskstats periodically, or files with the contents of /proc/diskstats, aggregates the data, and prints it nicely.


The following section is included to inform users about the potential risks, whether known or unknown, of using this tool. The two main categories of risks are those created by the nature of the tool (e.g. read-only tools vs. read-write tools) and those created by bugs.

pt-diskstats is a read-only tool. It should be very low-risk.

At the time of this release, we know of no bugs that could cause serious harm to users.

The authoritative source for updated information is always the online issue tracking system. Issues that affect this tool will be marked as such. You can see a list of such issues at the following URL:

See also “BUGS” for more information on filing bugs and getting help.


pt-diskstats tool is similar to iostat, but has some advantages. It separates reads and writes, for example, and computes some things that iostat does in either incorrect or confusing ways. It is also menu-driven and interactive with several different ways to aggregate the data, and integrates well with the pt-collect tool. These properties make it very convenient for quickly drilling down into I/O performance at the desired level of granularity.

This program works in two main modes. One way is to process a file with saved disk statistics, which you specify on the command line. The other way is to start a background process gathering samples at intervals and saving them into a file, and process this file in the foreground. In both cases, the tool is interactively controlled by keystrokes, so you can redisplay and slice the data flexibly and easily. If the tool is not attached to a terminal, it doesn’t run interactively; it just processes and prints its output, then exits. Otherwise it loops until you exit with the ‘q’ key.

If you press the ‘?’ key, you will bring up the interactive help menu that shows which keys control the program.

Files should have this format:

<contents of /proc/diskstats>
TS <timestamp>
<contents of /proc/diskstats>
... et cetera
TS <timestamp>  <-- must end with a TS line.

See for a detailed example of using the tool.


The columns are as follows:


The number of seconds of samples in the line. If there is only one, then the timestamp itself is shown, without the {curly braces}.


The device name. If there is more than one device, then instead the number of devices aggregated into the line is shown, in {curly braces}.


The number of megabytes read per second, average, during the sampled interval.


The average concurrency of the read operations, as computed by Little’s Law (a.k.a. queueing theory).


The average response time of the read operations, in milliseconds.


Megabytes written per second, average.


Write concurrency, similar to read concurrency.


Write response time, similar to read response time.


The fraction of time that the device had at least one request in progress; this is what iostat calls %util (which is a misleading name).


The number of requests that were in progress. Unlike the read and write concurrencies, which are averages that are generated from reliable numbers, this number is an instantaneous sample, and you can see that it might represent a spike of requests, rather than the true long-term average.

In addition to the above columns, there are a few columns that are hidden by default. If you press the ‘c’ key, and then press Enter, you will blank out the regular expression pattern that selects columns to display, and you will then see the extra columns:


The number of reads per second.


The average size of the reads, in kilobytes.


The percentage of read requests that were merged together in the disk scheduler before reaching the device.

wr_s, wr_avgkb, and wr_mrg

These are analogous to their rd_\* cousins.


Options must precede files on the command line.

-c COLS Awk regex of which columns to include (default cnc|rt|mb|busy|prg).
-d DEVICES Awk regex of which devices to include.

Group-by mode (default disk); specify one of the following:

disk   - Each line of output shows one disk device.
sample - Each line of output shows one sample of statistics.
all    - Each line of output shows one sample and one disk device.
-i INTERVAL In -g sample mode, include INTERVAL seconds per sample.
-k KEEPFILE File to save diskstats samples in (default /tmp/diskstats-samples). If a non-default filename is used, it will be saved for later analysis.
-n SAMPLES When in interactive mode, stop after N samples.
-s INTERVAL Sample /proc/diskstats every N seconds (default 1).


This tool does not use any environment variables.


This tool requires Bash v3 or newer and the /proc filesystem unless reading from files.


For a list of known bugs, see

Please report bugs at Include the following information in your bug report:

* Complete command-line used to run the tool

* Tool “–version”

* MySQL version of all servers involved

* Output from the tool including STDERR

* Input files (log/dump/config files, etc.)

If possible, include debugging output by running the tool with PTDEBUG; see “ENVIRONMENT”.


Visit to download the latest release of Percona Toolkit. Or, get the latest release from the command line:




You can also get individual tools from the latest release:


Replace TOOL with the name of any tool.


Baron Schwartz


This tool is part of Percona Toolkit, a collection of advanced command-line tools developed by Percona for MySQL support and consulting. Percona Toolkit was forked from two projects in June, 2011: Maatkit and Aspersa. Those projects were created by Baron Schwartz and developed primarily by him and Daniel Nichter, both of whom are employed by Percona. Visit for more software developed by Percona.


pt-diskstats 1.0.2

Contact Us

For free technical help, visit the Percona Community Forum.
To report bugs or submit feature requests, open a JIRA ticket.
For paid support and managed or professional services, contact Percona Sales.