系统范围 I/O 统计
在“vmstat”的早期版本中,设备次要版本用于确定它是分区还是磁盘(0 => 磁盘和 >0 => 分区)。难道我说的不对吗? 然后,从内核版本 2.6.x 开始,某些指标仅在磁盘级别进行测量,因此解析算法基于与设备关联的指标数量(11 个指标 => 磁盘,4 个指标 => 分区) 。
然而,在内核版本 2.6.18 中,分区也有 11 个指标,RAM 驱动器也有大于 0 的次要设备编号。请参阅下文:
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
在这种情况下,如何将分区与磁盘分离?我的最终目标是确定系统的整体 I/O。 在这方面的任何帮助将受到高度赞赏。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许看看现有的程序是做什么的? dstat 是一个很好的工具,用 python 编写。 iostat 是旧的传统工具,它的 -x 输出仅包括磁盘(和设备映射器设备),而不包括分区。
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.
嗯...当然那是我首先看的地方。不过,我对结果不太满意。但是,这是我发现的:
-- 运行 iostat -dkx ,您将获得系统中每个磁盘的每秒千字节读写量。 iostat 使用相当复杂的公式来完成此操作。
-- 获取任何 2.6.x 内核中的块输入和块输出(
pgpgin
和pgpgout
)的计数器值,并将其乘以 1024,您将得到准确的值同样的答案!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
andpgpgout
) in any 2.6.x kernel and multiply it by 1024, and you get the exact same answer!