/proc/diskstats各字段解析


今天來說說/proc/diskstats文件,這個文件用於顯示磁盤、分區和統計信息;

  1. [root@VM_54_118_centos ~]# cat /proc/diskstats
  2. 253 0 vda 222026 464 14148933 2387763 15975930 14162283 261012993 54210046 0 3186549 56602267
  3. 253 1 vda1 221980 464 14145765 2387590 15807400 14162283 261012993 54192784 0 3173037 56597649
  4. 253 16 vdb 1946 1 1330738 4704 332744 328392 9197624 303420 0 98203 308117
  5. 11 0 sr0 122 0 2012 92 0 0 0 0 0 91 92
  6. 7 0 loop0 0 0 0 0 0 0 0 0 0 0 0

(提前說明:由於我的測試主機是雲主機,所以磁盤的格式是vdX,如果是本地磁盤顯示的應該是sdX)
vda為整個虛擬磁盤的統計信息,vda1為第一個分區的統計信息;

上面這串字符從左往右依次表示:

253:主設備號,不同類別設備編號不一樣,虛擬磁盤統一為253,磁盤統一為8,環回設備統一為7

1:次設備號,比如vda的vda為0,vda1位1,vda2為2.也就是一個物理磁盤后面的分區,編號依次遞增

vda:設備名。一般ide接口的以hd[a-d]口命名,scsi和sata接口的以sd[a-z]命名。

輸出信息說明:

/proc/diskstats文件比/sys/block/sda/stat文件多3個域,從左至右分別對應主設備號,次設備號和設備名稱。后續的11個域在這兩個文件里是相同的,它們的函義將在下面解釋。除了第9個域,所有的域都是從啟動時的累積值。

  1. [root@VM_54_118_centos ~]# cat /sys/block/vda/stat
  2. 222026 464 14148933 2387763 15979071 14164711 261058873 54244380 0 3187473 56636601

下面是后面的11個域的輸出解釋

第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.)

轉載自: http://www.seiang.com/?p=394


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM