LoginSignup
12
13

More than 5 years have passed since last update.

vmstatのio/bi,boのblock/sついて

Last updated at Posted at 2019-01-22

vmstatでlinuxのパフォーマンス情報を確認をしますが、そのうちディスクI/Oの評価指標として使われるbi,boのblockについて「??」となってしまったので調べてみました。

# vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0    264 1386196   2128 360316    0    0   346   282  158  206  1  2 96  0  0

この[io]だけど調べてみると、

bi : ブロックデバイスから受け取ったブロック数 (blocks/s)
bo : ブロックデバイスへ送られたブロック数 (blocks/s)

と当たり前のようにググったらすぐでてきます。
ということは、

1秒間にディスクに対して何block数読み込んだか=bi

1秒間にディスクに対して何block数書き込んだか=bo

となります。

・・・このblockってvmstatだと1block何バイトだよ??というのがなかなかわからず地味に調べるのに時間かかりました。
(OSシステムによって違うとか、ファイルシステムによって違うとか、コマンドによってblockのサイズは異なるとか…何が真実なんだか…)

といろいろ調べたうえで答えとなりうる情報がのっているサイトがこちらでした。

http://wiki.linuxquestions.org/wiki/Vmstat

io
The numbers are seen from the processor. So, for io, bi (block in) means blocks that e.g. come from the harddrive or from the network card. bo (block out) means blocks that are sent from the processor to the network card or to the hard disk. If you want to know your file system's block size, use

stat -f /mnt/sdb1

結論、vmstatはファイルシステムのblockサイズであり調べるにはstat -f /mnt/sdb1やればいいとのこと。

# stat -f /tmp
  File: "/tmp"
    ID: fd0000000000 Namelen: 255     Type: xfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 4538880    Free: 3562754    Available: 3562754
Inodes: Total: 9082880    Free: 9003333

CentOS7系であればxfsでデフォルトでファイルシステム作成してるはず=大抵4096byteなので、最初の例を使うと

bi = 346 block/s = 346 × 4096 byte/s ≒ 1.4 Mbyte/s
bo = 282 block/s = 282 × 4096 byte/s ≒ 1.2 Mbyte/s

すこしすっきり

12
13
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13