/proc/diskstats 注解
今兒在准備利用shell監控磁盤讀寫次數等信息時,看到該文件,但是又不清楚每段的具體含義,這里備注下。
文件內容
[root@namenode proc]# cat diskstats 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 1 4 ram4 0 0 0 0 0 0 0 0 0 0 0 1 5 ram5 0 0 0 0 0 0 0 0 0 0 0 1 6 ram6 0 0 0 0 0 0 0 0 0 0 0 1 7 ram7 0 0 0 0 0 0 0 0 0 0 0 1 8 ram8 0 0 0 0 0 0 0 0 0 0 0 1 9 ram9 0 0 0 0 0 0 0 0 0 0 0 1 10 ram10 0 0 0 0 0 0 0 0 0 0 0 1 11 ram11 0 0 0 0 0 0 0 0 0 0 0 1 12 ram12 0 0 0 0 0 0 0 0 0 0 0 1 13 ram13 0 0 0 0 0 0 0 0 0 0 0 1 14 ram14 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 1 loop1 0 0 0 0 0 0 0 0 0 0 0 7 2 loop2 0 0 0 0 0 0 0 0 0 0 0 7 3 loop3 0 0 0 0 0 0 0 0 0 0 0 7 4 loop4 0 0 0 0 0 0 0 0 0 0 0 7 5 loop5 0 0 0 0 0 0 0 0 0 0 0 7 6 loop6 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 161825 32656 12306800 110421 3250057 6321432 89861512 3881319 0 3288546 3989923 8 1 sda1 737 496 13868 61 129 5349 10968 578 0 257 639 8 2 sda2 160934 32160 12291700 110350 2775297 6316083 89850544 1564080 0 1009226 1672710 11 0 sr0 48 0 384 4 0 0 0 0 0 4 4 11 1 sr1 0 0 0 0 0 0 0 0 0 0 0 253 0 dm-0 110730 0 4684314 114640 4879595 0 55689296 25927606 0 2862098 26042976 253 1 dm-1 7482 0 59856 8656 21296 0 170368 55930 0 1326 64657 253 2 dm-2 75407 0 7546602 20849 4267078 0 33990880 13185771 0 469527 13206732 [root@namenode proc]#
這個文件用於顯示磁盤、分區和統計信息:sda為整個硬盤的統計信息,sda1為第一個分區的統計信息,sda2為第二個分區的統計信息,ramdisk設備為通過軟件將RAM當做硬盤來使用的一項技術。
各部分含義
/proc/diskstats文件比/sys/block/sda/stat文件多3個域,從左至右分別對應主設備號,次設備號和設備名稱。后續的11個域在這兩個文件里是相同的,它們的函義將在下面解釋。除了第9個域,所有的域都是從啟動時的累積值。
第1個域:讀完成次數 ----- 讀磁盤的次數,成功完成讀的總次數。
(number of issued reads. This is the total number of reads completed successfully.)
第2個域:合並讀完成次數, 第6個域:合並寫完成次數。為了效率可能會合並相鄰的讀和寫。從而兩次4K的讀在它最終被處理到磁盤上之前可能會變成一次8K的讀,才被計數(和排隊),因此只有一次I/O操作。這個域使你知道這樣的操作有多頻繁。
(number of reads merged)
第3個域:讀扇區的次數,成功讀過的扇區總次數。
(number of sectors read. This is the total number of sectors read successfully.)
第4個域:讀花費的毫秒數,這是所有讀操作所花費的毫秒數(用__make_request()到end_that_request_last()測量)。
(number of milliseconds spent reading. This is the total number of milliseconds spent by all reads (as measured from __make_request() to end_that_request_last()).)
第5個域:寫完成次數 ----寫完成的次數,成功寫完成的總次數。
(number of writes completed. This is the total number of writes completed successfully.)
第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.)
第7個域:寫扇區次數 ---- 寫扇區的次數,成功寫扇區總次數。
(number of sectors written. This is the total number of sectors written successfully.)
第8個域:寫操作花費的毫秒數 --- 寫花費的毫秒數,這是所有寫操作所花費的毫秒數(用__make_request()到end_that_request_last()測量)。
(number of milliseconds spent writing This is the total number of milliseconds spent by all writes (as measured from __make_request() to end_that_request_last()).)
第9個域:正在處理的輸入/輸出請求數 -- -I/O的當前進度,只有這個域應該是0。當請求被交給適當的request_queue_t時增加和請求完成時減小。
(number 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.)
第10個域:輸入/輸出操作花費的毫秒數 ----花在I/O操作上的毫秒數,這個域會增長只要field 9不為0。
(number of milliseconds spent doing I/Os. This field is increased so long as field 9 is nonzero.)
第11個域:輸入/輸出操作花費的加權毫秒數 ----- 加權, 花在I/O操作上的毫秒數,在每次I/O開始,I/O結束,I/O合並時這個域都會增加。這可以給I/O完成時間和存儲那些可以累積的提供一個便利的測量標准。
(number 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.)