VMSTAT(8)

๐Ÿ’– VMSTAT(8) ๐Ÿ’– โ€” like, the system manager's manual era, bestie

okay so you found vmstat(8) and you're like "what is this mysterious little command" โ€” don't worry, I got you. This is the group chat rundown of the virtual memory statistics reporter. Pull up a chair, grab a strawberry ๐Ÿ“, and let's get into it.


โœจ NAME โœจ

vmstat โ€” report virtual memory statistics ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

vmstat [option ...] [delay [count]]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So vmstat is the bestie that tells you what's actually going on with your machine. It reports information about:

  • processes
  • memory
  • paging
  • block IO
  • traps
  • disks
  • cpu activity

The first report it gives you is averages since the last reboot. Like, the whole vibe since boot. Every report after that gives you info on a sampling period of length delay. The process and memory reports are instantaneous in either case โ€” no cap. โญ


๐ŸŽ€ OPTIONS ๐ŸŽ€

  • delay โ€” the delay between updates, in seconds. If you don't specify a delay, only one report gets printed, with the average values since boot. one and done, iconic behavior.
  • count โ€” number of updates. If there's no count but delay is defined, the default is infinite. yes bestie, infinite. it will simply keep going forever. ๐Ÿซถ
  • -a, --active โ€” display active and inactive memory. needs a 2.5.41 kernel or better.
  • -f, --forks โ€” displays the number of forks since boot. This includes the fork, vfork, and clone system calls, and it's equivalent to the total number of tasks created. Each process is represented by one or more tasks, depending on thread usage. This display does not repeat.
  • -m, --slabs โ€” displays slabinfo.
  • -n, --one-header โ€” display the header only once instead of periodically. one header, one moment, periodt.
  • -s, --stats โ€” displays a table of various event counters and memory statistics. This display does not repeat.
  • -d, --disk โ€” report disk statistics (2.5.70 or above required).
  • -D, --disk-sum โ€” report some summary statistics about disk activity.
  • -p, --partition device โ€” detailed statistics about partition (2.5.70 or above required).
  • -S, --unit character โ€” switches outputs between 1000 (k), 1024 (K), 1000000 (m), or 1048576 (M) bytes. > note: this does not change the block (bi/bo) fields. no ma'am, those stay exactly where they are.
  • -t, --timestamp โ€” append timestamp to each line
  • -w, --wide โ€” wide output mode. useful for systems with higher amounts of memory, where the default output mode suffers from unwanted column breakage. the output is wider than 80 characters per line.
  • -y, --no-first โ€” omits the first report with statistics since system boot.
  • -V, --version โ€” display version information and exit.
  • -h, --help โ€” display help and exit.

๐ŸŒˆ FIELD DESCRIPTION FOR VM MODE ๐ŸŒˆ

๐Ÿงš Procs

  • r: the number of runnable processes (running or waiting for run time).
  • b: the number of processes blocked waiting for I/O to complete.

๐Ÿงš Memory

These are affected by the --unit option.

  • swpd: the amount of swap memory used.
  • free: the amount of idle memory.
  • buff: the amount of memory used as buffers.
  • cache: the amount of memory used as cache.
  • inact: the amount of inactive memory. (-a option)
  • active: the amount of active memory. (-a option)

๐Ÿงš Swap

These are affected by the --unit option.

  • si: amount of memory swapped in from disk (/s).
  • so: amount of memory swapped to disk (/s).

๐Ÿงš IO

  • bi: kibibyte received from a block device (KiB/s).
  • bo: kibibyte sent to a block device (KiB/s).

๐Ÿงš System

  • in: the number of interrupts per second, including the clock.
  • cs: the number of context switches per second.

๐Ÿงš CPU

These are percentages of total CPU time.

  • us: time spent running non-kernel code. (user time, including nice time)
  • sy: time spent running kernel code. (system time)
  • id: time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
  • wa: time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
  • st: time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.
  • gu: time spent running KVM guest code (guest time, including guest nice).

๐Ÿ”ฅ FIELD DESCRIPTION FOR DISK MODE ๐Ÿ”ฅ

๐Ÿ’œ Reads

  • total: total reads completed successfully
  • merged: grouped reads (resulting in one I/O)
  • sectors: sectors read successfully
  • ms: milliseconds spent reading

๐Ÿ’œ Writes

  • total: total writes completed successfully
  • merged: grouped writes (resulting in one I/O)
  • sectors: sectors written successfully
  • ms: milliseconds spent writing

๐Ÿ’œ IO

  • cur: I/O in progress
  • s: seconds spent for I/O

๐Ÿ‘‘ FIELD DESCRIPTION FOR DISK PARTITION MODE ๐Ÿ‘‘

  • reads: total number of reads issued to this partition
  • read sectors: total read sectors for partition
  • writes : total number of writes issued to this partition
  • requested writes: total number of write requests made for partition

๐Ÿ’€ FIELD DESCRIPTION FOR SLAB MODE ๐Ÿ’€

Slab mode shows statistics per slab. For more information about this information see slabinfo(5).

  • cache: cache name
  • num: number of currently active objects
  • total: total number of available objects
  • size: size of each object
  • pages: number of pages with at least one active object

๐Ÿ™ˆ NOTES ๐Ÿ™ˆ

vmstat requires read access to files under /proc. The -m requires read access to /proc/slabinfo, which may not be available to standard users. Mount options for /proc such as subset=pid may also impact what is visible.

fr fr, if your numbers look weird or missing, check your /proc permissions first. lowkey the number one culprit. ๐Ÿ˜ญ

๐ŸŒŸ SEE ALSO ๐ŸŒŸ

free(1), iostat(1), mpstat(1), ps(1), sar(1), top(1), slabinfo(5)


๐ŸŽฏ REPORTING BUGS ๐ŸŽฏ

Please send bug reports to procps@freelists.org.


and that's the whole page bestie, you ate that ๐Ÿซถ this one's from procps-ng, dated 2024-07-19 โ€” so go forth, run vmstat, and watch your machine's whole soul in real time. slay โœจ๐Ÿ’–

๐Ÿ“ฆ where this page comes from