# Block layer statistics in /sys/block/<dev>/stat

_Peios Kernel / Internals / Block_

> This file documents the contents of the /sys/block/<dev>/stat file.

<a id="rst-block-layer-statistics-in-sys-block-dev-stat"></a>

This file documents the contents of the /sys/block/&lt;dev&gt;/stat file.

The stat file provides several statistics about the state of block device &lt;dev&gt;.

- **Q.** Why are there multiple statistics in a single file?  Doesn't sysfs normally contain a single value per file?

- **A.** By having a single file, the kernel can guarantee that the statistics represent a consistent snapshot of the state of the device.  If the statistics were exported as multiple files containing one statistic each, it would be impossible to guarantee that a set of readings represent a single point in time.

The stat file consists of a single line of text containing 17 decimal values separated by whitespace.  The fields are summarized in the following table, and described in more detail below.


<table>
<thead>
<tr>
<th>


Name

</th>
<th>


units

</th>
<th>


description

</th>
</tr>
</thead>
<tbody>
<tr>
<td>


read I/Os

</td>
<td>


requests

</td>
<td>


number of read I/Os processed

</td>
</tr>
<tr>
<td>


read merges

</td>
<td>


requests

</td>
<td>


number of read I/Os merged with in-queue I/O

</td>
</tr>
<tr>
<td>


read sectors

</td>
<td>


sectors

</td>
<td>


number of sectors read

</td>
</tr>
<tr>
<td>


read ticks

</td>
<td>


milliseconds

</td>
<td>


total wait time for read requests

</td>
</tr>
<tr>
<td>


write I/Os

</td>
<td>


requests

</td>
<td>


number of write I/Os processed

</td>
</tr>
<tr>
<td>


write merges

</td>
<td>


requests

</td>
<td>


number of write I/Os merged with in-queue I/O

</td>
</tr>
<tr>
<td>


write sectors

</td>
<td>


sectors

</td>
<td>


number of sectors written

</td>
</tr>
<tr>
<td>


write ticks

</td>
<td>


milliseconds

</td>
<td>


total wait time for write requests

</td>
</tr>
<tr>
<td>


in_flight

</td>
<td>


requests

</td>
<td>


number of I/Os currently in flight

</td>
</tr>
<tr>
<td>


io_ticks

</td>
<td>


milliseconds

</td>
<td>


total time this block device has been active

</td>
</tr>
<tr>
<td>


time_in_queue

</td>
<td>


milliseconds

</td>
<td>


total wait time for all requests

</td>
</tr>
<tr>
<td>


discard I/Os

</td>
<td>


requests

</td>
<td>


number of discard I/Os processed

</td>
</tr>
<tr>
<td>


discard merges

</td>
<td>


requests

</td>
<td>


number of discard I/Os merged with in-queue I/O

</td>
</tr>
<tr>
<td>


discard sectors

</td>
<td>


sectors

</td>
<td>


number of sectors discarded

</td>
</tr>
<tr>
<td>


discard ticks

</td>
<td>


milliseconds

</td>
<td>


total wait time for discard requests

</td>
</tr>
<tr>
<td>


flush I/Os

</td>
<td>


requests

</td>
<td>


number of flush I/Os processed

</td>
</tr>
<tr>
<td>


flush ticks

</td>
<td>


milliseconds

</td>
<td>


total wait time for flush requests

</td>
</tr>
</tbody>
</table>

<a id="rst-read-i-os-write-i-os-discard-i-0s"></a>

## read I/Os, write I/Os, discard I/0s

These values increment when an I/O request completes.

<a id="rst-flush-i-os"></a>

## flush I/Os

These values increment when an flush I/O request completes.

Block layer combines flush requests and executes at most one at a time. This counts flush requests executed by disk. Not tracked for partitions.

<a id="rst-read-merges-write-merges-discard-merges"></a>

## read merges, write merges, discard merges

These values increment when an I/O request is merged with an already-queued I/O request.

<a id="rst-read-sectors-write-sectors-discard-sectors"></a>

## read sectors, write sectors, discard_sectors

These values count the number of sectors read from, written to, or discarded from this block device.  The "sectors" in question are the standard UNIX 512-byte sectors, not any device- or filesystem-specific block size.  The counters are incremented when the I/O completes.

<a id="rst-read-ticks-write-ticks-discard-ticks-flush-ticks"></a>

## read ticks, write ticks, discard ticks, flush ticks

These values count the number of milliseconds that I/O requests have waited on this block device.  If there are multiple I/O requests waiting, these values will increase at a rate greater than 1000/second; for example, if 60 read requests wait for an average of 30 ms, the read_ticks field will increase by 60\*30 = 1800.

<a id="rst-in-flight"></a>

## in_flight

This value counts the number of I/O requests that have been issued to the device driver but have not yet completed.  It does not include I/O requests that are in the queue but not yet issued to the device driver.

<a id="rst-io-ticks"></a>

## io_ticks

This value counts the number of milliseconds during which the device has had I/O requests queued.

<a id="rst-time-in-queue"></a>

## time_in_queue

This value counts the number of milliseconds that I/O requests have waited on this block device.  If there are multiple I/O requests waiting, this value will increase as the product of the number of milliseconds times the number of requests waiting (see "read ticks" above for an example).
