Pages

Sunday, April 16, 2017

How to calculate the usage of Block disks

# cat /sys/block/<dev>/stat

186908    41568  6033917  2408504    91198   509600  4882200  9406764        0  1161304 11848624

Field  1 -- Number of reads issued
This is the total number of reads completed successfully.

Field  2 -- Number of reads merged, field 6 -- Number of writes merged
Reads and writes which are adjacent to each other may be merged for efficiency.  Thus two 4K reads may become one 8K read before it is ultimately handed to the disk, and so it will be counted (and queued) as only one I/O.  This field lets you know how often this was done.

Field  3 -- Numberof sectors read - This is the total number of sectors read successfully.

Field  4 -- Number of milliseconds spent reading

Field  5 -- Total Number of writes completed 

Field  7 --  Total number of sectors written 

Field  8 -- # of milliseconds spent writing 

Field  9 -- # of I/Os currently in progress
The only field that should go to zero. Incremented as requests are given to appropriate request_queue_t and decremented as they finish.

Field 10 -- # of milliseconds spent doing I/Os
This field is increases so long as field 9 is nonzero.

Field 11 -- weighted # of milliseconds spent doing I/Os

This field is incremented at each I/O start, I/O completion, I/O merge, or read of these stats by the number of I/Os in progress (field 9) times the number of milliseconds spent doing I/O since the last update of this field.  This can provide an easy measure of both I/O completion time and the backlog that may be accumulating.

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

Below command will print size in bytes to get the actual size in GB then divide  by 1024 thrice. This will give the total size of the particular partition or disk in bytes

cat /proc/diskstats


http://lxr.linux.no/linux+v3.5/Documentation/iostats.txt

Read more: http://linuxpoison.blogspot.nl/2009/02/how-to-measure-and-read-disk-activity.html#ixzz4c1GPbAPb

No comments:

Post a Comment