views:

66

answers:

2

Hey,

In earlier versions of "vmstat", the device minor version was used to determine whether it was a partition or a disk (0 => disk and >0 => partition)). Am I not correct? Then, from kernel version 2.6.x some metrics were measured only at the disk-level, and hence the parsing algorithm was based on the number of metrics associated with a device (11 metrics => disk and 4 metrics => partition).

However, in kernel version 2.6.18 there are also 11 metrics for partitions, and RAM drives also have minor device numbers greater than 0. See below:

   1    0 ram0 0 0 0 0 0 0 0 0 0 0 0
   1    1 ram1 0 0 0 0 0 0 0 0 0 0 0
   1    2 ram2 0 0 0 0 0 0 0 0 0 0 0
   1    3 ram3 0 0 0 0 0 0 0 0 0 0 0
   3    0 hda 364304 44416 9757168 9689046 18080864 19417076 299988386 1952073601 0 167032032 1961762954
   3    1 hda1 170 1105 2566 2352 5 0 10 13 0 1854 2365
   3    2 hda2 364112 43281 9754186 9686147 18080859 19417076 299988376 1952073588 0 167031121 1961760042
 253    0 dm-0 405386 0 9738418 14371284 37409328 0 299274624 2479168190 0 167053870 2493542151
 253    1 dm-1 1906 0 15248 70026 89219 0 713752 70030052 0 70247 70100078
  22   64 hdd 0 0 0 0 0 0 0 0 0 0 0
   2    0 fd0 0 0 0 0 0 0 0 0 0 0 0
   9    0 md0 0 0 0 0 0 0 0 0 0 0 0

How do I go about separating partitions from disks in this case? My final object is to determine the overall I/O of the system. Any help in this regard will be highly appreciated.

A: 

Maybe have a look at what existing programs do? dstat is a good one, written in python. iostat is the old traditional one, and it's -x output only includes disks (and device-mapper devices), not partitions.

Peter Cordes
A: 

Hmmm... Well of course that's the first place I looked. I wasn't quite satisfied, though, with the results. But, here's what I discovered:

-- Run iostat -dkx and you'll get KBytes/sec read and written to and from every disk in the system. iostat uses quite a complex formula to do it.

-- Take the values of the counters for blocks in and blocks out (pgpgin and pgpgout) in any 2.6.x kernel and multiply it by 1024, and you get the exact same answer!

themoondothshine