I'm writing a routine to report metrics using /proc/diskstat, which reports data for disk activity. The numbers are NOT adding up.

Example:

[esm@graphdb301p:lib]$ cat /proc/diskstats
1       0 ram0 0 0 0 0 0 0 0 0 0 0 0 
...
1      15 ram15 0 0 0 0 0 0 0 0 0 0 0
7       0 loop0 0 0 0 0 0 0 0 0 0 0 0
...
7       7 loop7 0 0 0 0 0 0 0 0 0 0 0
8       0 sda 357988 499995 9002150 1092949 36213840 257661933 2352749204 76049110 0 20178750 77123506
8       1 sda1 691 434 13908 345 148 5213 10740 1037 0 1021 1381
8       2 sda2 629 1391 16160 1658 715 10378 88744 2520 0 3934 4174
8       3 sda3 356344 498170 8969490 1090866 36212977 257646342 2352649720 76045553 0 20174790 77117871    

By my reading of the docs, I'm supposed to be able to add sda1+sda2+sda3=sda. This is ALMOST TRUE. But, it's off:

  356344 sda3
  +  629 sda2
  +  691 sda1
  ------
= 357644   BUT 
  357988  IS THE sda VALUE.  

WHY DOES THIS NOT ADD UP ???

有帮助吗?

解决方案

There are always a few bytes taken by the partition table. Additionally, there could be blocks marked as bad as well, most HDs have a few bad blocks even when new.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top