Skip to main content
LPIC-2 Exam 201

Understanding the output of vmstat

By May 24, 2014September 12th, 2022No Comments

LPIC-2-201For the LPIC-2 201 exam the first topic will will look at is /usr/bin/vmstat. This part of the new objective to LPIC-2 added in November 2013. It makes sense to look at vmstat first as it is usually part of the base install of most Linux distributions be in the package procps. It sister program like mpstat come with the package sysstat.

On Debian based systems try the command:

dpkg -S $(which vmstat)

On CentOS / Red Hat

rpm -qf $(which vmstat)

The output from both will indicate the file belongs to the package procps.

The command vmstat can be run on its own without any options or arguments or we can supply integer values for the interval and count:

vmstat 3 5

Where we will run vmstat 5 times with a 3 second interval. The columns in the output show:

  • procs
  • memory
  • swap
  • io
  • system
  • cpu

Much of the output is self explanatory but we highlight a few areas here. Under procs we have:

  • r : Running process thread for a single processor we like this to be below 1, this represents to process queue. If we had 2 CPUs or cores the less than 2 is the desired maximum etc
  • b : This is the blocked queue where we are waiting on resource. this is usually an indications of slow disks or disk architecture.

Under IO we have:

  • bi : Blocks in from the disk (reads)
  • bo : Blocks out to the disk (writes)

Under System we have :

  • in : Interrupts per second, CPU requests per second
  • cs : Context switches per second, idea of mulch-tasking, how many time per second do the CPU switch between tasks