Linux – the difference between /sys/block/sda1/stat and /sys/block/xvda1/stat

amazon ec2linuxsysfs

On my local machine, I have /sys/block/sda1/stat.
On an Amazon machine, I have /sys/block/xvda1/stat.

When I run cat /sys/block/sda1/stat or cat /sys/block/xvda1/stat both give 11 fields of output.

What is the difference between /sys/block/sda1/stat and /sys/block/xvda1/stat files?

Best Answer

The /sys directory is generally where the sysfs filestystem is mounted, which contains information about devices and other kernel information.

The files in /sys/block contain information about block devices on your system. Your local system has a block device named sda, so /sys/block/sda exists. Your Amazon instance has a device named xvda, so /sys/block/xvda exists.

The /sys/block/<dev>/stat file provides several statistics about the state of block device <dev>. It consists of a single line of text containing 11 decimal values separated by whitespace:

Name            units         description
----            -----         -----------
read I/Os       requests      number of read I/Os processed
read merges     requests      number of read I/Os merged with in-queue I/O
read sectors    sectors       number of sectors read
read ticks      milliseconds  total wait time for read requests
write I/Os      requests      number of write I/Os processed
write merges    requests      number of write I/Os merged with in-queue I/O
write sectors   sectors       number of sectors written
write ticks     milliseconds  total wait time for write requests
in_flight       requests      number of I/Os currently in flight
io_ticks        milliseconds  total time this block device has been active
time_in_queue   milliseconds  total wait time for all requests

So, each block device will have its own statistics file, hence the different values.
See kernel docs for more details.

Related Question