Vmstat

From LQWiki
Jump to navigation Jump to search

vmstat shows you statistics about your current system activity, e.g. I/O operations, swapping and memory usage:

$ vmstat 5
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
 1  0  17116   3440   3932  70976    1    6   161    23  548   232 22  4 58 16
 3  0  17584   1812   3724  69040    0   94   270   563 1071   523 66 10  9 15
 1  0  17656   5204   3820  69716    0   14   162   160 1027   344 23  7 59 11
 0  0  17656   6364   3848  69916    6    0    16   126 1010   238 17  3 76  3

cpu

The 'us' (user) column will be mostly from application level processing, while the 'sy' (system) column is kernel (inside device drivers, filesystem code, etc.).

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

if your file system is mounted on /mnt/sdb1. If your file system is ext3, you do not need to mount it to find out its block size, just use

tune2fs -l /dev/sdb1

See also