{"id":463,"date":"2022-10-12T06:13:16","date_gmt":"2022-10-12T06:13:16","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2015\/12\/12\/20-vmstat-commands-examples-in-linux-unix\/"},"modified":"2022-12-23T05:45:52","modified_gmt":"2022-12-23T05:45:52","slug":"20-vmstat-commands-examples-in-linux-unix","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/20-vmstat-commands-examples-in-linux-unix\/","title":{"rendered":"Linux Tutorials: vmstat commands examples"},"content":{"rendered":"\n<p>The vmstat command (<strong>short for virtual memory statistics<\/strong>) is a built-in monitoring utility in Linux. Users can observe system activity virtually in real-time by specifying a sampling period. The command helps you identify performance bottlenecks and diagnose problems in your system. The command is used to obtain information about following<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>memory,<\/li><li>system processes,<\/li><li>paging,<\/li><li>interrupts,<\/li><li>block I\/O,<\/li><li>disk, and<\/li><li>CPU scheduling<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How to install vmstat?<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">$ sudo apt install sysstat         &#91;On Debian, Ubuntu and Mint]\n$ sudo yum install sysstat         &#91;On RHEL\/CentOS\/Fedora and Rocky Linux\/AlmaLinux]\n$ sudo emerge -a app-admin\/sysstat &#91;On Gentoo Linux]\n$ sudo pacman -S sysstat           &#91;On Arch Linux]\n$ sudo zypper install sysstat      &#91;On OpenSUSE]   \n<\/code><\/span><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">$ vmstat -a<\/h2>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st\n 0  0      0 128240 818236 797612    0    0     4    18  127  244  0  0 100  0  0\n<\/code><\/span><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"470\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/10\/vmstat-fields-and-explanation.jpg\" alt=\"\" class=\"wp-image-31534\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/10\/vmstat-fields-and-explanation.jpg 719w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/10\/vmstat-fields-and-explanation-300x196.jpg 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">$ vmstat -s<\/h2>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">      2020092 K total memory\n       280684 K used memory\n       797668 K active memory\n       818204 K inactive memory\n       128240 K free memory\n        44440 K buffer memory\n      1566728 K swap cache\n            0 K total swap\n            0 K used swap\n            0 K free swap\n        33428 non-nice user cpu ticks\n         3750 nice user cpu ticks\n        10322 system cpu ticks\n     17519407 idle cpu ticks\n         2294 IO-wait cpu ticks\n            0 IRQ cpu ticks\n          146 softirq cpu ticks\n         4287 stolen cpu ticks\n       752241 pages paged in\n      3243317 pages paged out\n            0 pages swapped in\n            0 pages swapped out\n     22338795 interrupts\n     42924056 CPU context switches\n   1665378296 boot time\n        40142 forks<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">$ vmstat -h<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Usage:\n vmstat &#91;options] &#91;delay &#91;count]]\n\nOptions:\n -a, --active           active\/inactive memory\n -f, --forks            number of forks since boot\n -m, --slabs            slabinfo\n -n, --one-header       <span class=\"hljs-keyword\">do<\/span> not redisplay header\n -s, --stats            event counter statistics\n -d, --disk             disk statistics\n -D, --disk-sum         summarize disk statistics\n -p, --partition &lt;dev&gt;  partition specific statistics\n -S, --unit &lt;char&gt;      define display unit\n -w, --wide             wide output\n -t, --timestamp        show timestamp\n\n -h, --help     display this help <span class=\"hljs-keyword\">and<\/span> <span class=\"hljs-keyword\">exit<\/span>\n -V, --version  output version information <span class=\"hljs-keyword\">and<\/span> <span class=\"hljs-keyword\">exit<\/span>\n\n<span class=\"hljs-keyword\">For<\/span> more details see vmstat(<span class=\"hljs-number\">8<\/span>).\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">vmstat commands example<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">strong<\/span>&gt;<\/span>Example: vmstat 1 5<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">strong<\/span>&gt;<\/span>\n    1 -&gt; the values will be re-measured and reported every second\n    5 -&gt; the values will be reported five times and then the program will stop<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Execute vmstat \u2018X\u2019 seconds and (\u2018N\u2019number of times). With this command, vmstat execute every two seconds and stop automatically after executing six intervals.<\/strong><br>$ vmstat 2 6<\/p>\n\n\n\n<p><strong>Vmstat with timestamps. vmstat command with -t parameter shows timestamps with every line printed as shown below.<\/strong><br>$ vmstat -t 1 5<\/p>\n\n\n\n<p><strong>Statistics of Various Counter, vmstat command and -s switch displays summary of various event counters and memory statistics.<\/strong><br>$ vmstat -s<\/p>\n\n\n\n<p><strong>Disks Statistics, vmstat with -d option display all disks statistics.<\/strong><br>$ vmstat -d<\/p>\n\n\n\n<p><strong>Display Statistics in Megabytes, The vmstat displays in Megabytes with parameters -S and M(Uppercase &amp; megabytes). By default vmstat displays statistics in kilobytes.<\/strong><br>$ vmstat -S M 1 5<\/p>\n\n\n\n<p><strong>Display number of forks since last boot, This displays all the fork system calls made by the system since the last boot. This displays all fork, vfork, and clone system call counts.<\/strong><br>$ vmstat -f<\/p>\n\n\n\n<p><strong>Display slab info, Use option -m, to display the slab info as shown below.<\/strong><br>$ vmstat -m<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Understanding vmstat output<\/h2>\n\n\n\n<p>There are four sections in the output:<\/p>\n\n\n\n<p>1. The first section of the output deals with the<strong>&nbsp;amount of used memory:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Total&nbsp;<strong>physical memory.<\/strong><\/li><li>Currently&nbsp;<strong>used memory.<\/strong><\/li><li><strong>Active memory.<\/strong><\/li><li><strong>Inactive memory.<\/strong><\/li><li><strong>Free&nbsp;<\/strong>memory.<\/li><li><strong>Buffer&nbsp;<\/strong>memory.<\/li><li><strong>Cache&nbsp;<\/strong>memory.<\/li><li><strong>Swap&nbsp;<\/strong>memory information.<\/li><\/ul>\n\n\n\n<p>2. The second section displays&nbsp;<strong>CPU statistics:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Non-nice CPU ticks \u2013 the number of times the CPU was used for&nbsp;<strong>high priority&nbsp;<\/strong>processes.<\/li><li>Nice CPU ticks \u2013 the number of times the CPU was used for&nbsp;<strong>lower priority&nbsp;<\/strong>processes.<\/li><li>System CPU ticks \u2013 the number of times the CPU was used for&nbsp;<strong>kernel processes.<\/strong><\/li><li>Idle CPU ticks \u2013 the number of times the CPU was&nbsp;<strong>idle.<\/strong><\/li><li>IO-wait \u2013 the number of times the CPU was used for&nbsp;<strong>input\/output management.<\/strong><\/li><li>IRQ \u2013 the number of times the CPU received&nbsp;<strong>interrupt requests.<\/strong><\/li><li>softirq \u2013 the number of times the CPU received&nbsp;<strong>software interrupts.<\/strong><\/li><li>stolen CPU ticks \u2013 the number of times a virtual machine stole CPU time.<\/li><\/ul>\n\n\n\n<p>3. The third section shows<strong>&nbsp;values related to memory paging:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Total<strong>&nbsp;pages paged in<\/strong>&nbsp;from virtual memory.<\/li><li>Total<strong>&nbsp;pages paged out&nbsp;<\/strong>to virtual memory.<\/li><li>Total&nbsp;<strong>pages read from<\/strong>&nbsp;swap memory.<\/li><li>Total&nbsp;<strong>pages written to<\/strong>&nbsp;swap memory.<\/li><\/ul>\n\n\n\n<p>4. The last section describes&nbsp;<strong>various event counters:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The number of&nbsp;<strong>interrupts<\/strong>&nbsp;since boot.<\/li><li>The number of&nbsp;<strong>context switches<\/strong>&nbsp;performed.<\/li><li>The&nbsp;<strong>timestamp<\/strong>&nbsp;for the last boot time.<\/li><li>The total number of&nbsp;<strong>forks.<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Decoding vmstat output<\/h2>\n\n\n\n<p>Examples<br>CPU User Load Example<\/p>\n\n\n\n<p>A standard audio file will be encode as an MP3 file by means of the lame encoder[1] in this example. This process is quite CPU intensive and also demonstrates the execution of vmstat in parallel with a user CPU time of 97%:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@RHEL ~]$ vmstat 1 5\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 6  1      0 302380  16356 271852    0    0   561   568   80  590 43  7 43  7  0\n 1  0      0 300892  16364 273256    0    0     0    52   79  274 97  3  0  0  0\n 2  0      0 299544  16364 274532    0    0     0     0   78  372 97  3  0  0  0\n 1  0      0 298292  16368 275780    0    0     0     0   53  255 97  3  0  0  0\n 1  0      0 296820  16368 277192    0    0     0     0   77  377 97  3  0  0  0\n&#91;user@RHEL ~]$\n<\/code><\/span><\/pre>\n\n\n<p>CPU System Load Example<\/p>\n\n\n\n<p>In this example, a file will be filled with random content using dd.<\/p>\n\n\n\n<p>[user@fedora9 ~]$ dd if=\/dev\/urandom of=500MBfile bs=1M count=500<\/p>\n\n\n\n<p>For this, \/dev\/urandom[2] will supply random numbers, which will be generated by the kernel. This will lead to an increased load on the CPU (sy \u2013 system time). At the same time, the vmstat executing in parallel will indicate that between 93% and 97% of the CPU time is being used for the execution of kernel code (for the generation of random numbers, in this case).<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@RHEL ~]$ vmstat 1 5\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 2  0 402944  54000 161912 745324    5   14    54    59  221  867 13  3 82  2  0\n 1  0 402944  53232 161916 748396    0    0     0     0   30  213  3 97  0  0  0\n 1  0 402944  49752 161920 751452    0    0     0     0   28  290  4 96  0  0  0\n 1  0 402944  45804 161924 755564    0    0     0     0   29  188  2 98  0  0  0\n 1  0 402944  42568 161936 758608    0    0     0 17456  272  509  7 93  0  0  0\n&#91;user@RHEL ~]$\n<\/code><\/span><\/pre>\n\n\n<p>The time for executing system calls[3][4][5] will be counted as system time (sy).<br>RAM Bottleneck (swapping) Example<\/p>\n\n\n\n<p>In this example, many applications will be opened (including VirtualBox with a Windows guest system, among others). Almost all of the working memory will be used. Then, one more application (OpenOffice) will be started. The Linux kernel will then swap out several memory pages to the swap file on the hard disk, in order to get more RAM for OpenOffice. Swapping the memory pages to the swap file will be seen in the so (swap out &#8211; memory swapped to disk) column as vmstat executes in parallel.<\/p>\n\n\n\n<p><a href=\"https:\/\/access.redhat.com\/solutions\/1160343#\" target=\"_blank\" rel=\"noopener\">Raw<\/a><\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@RHEL ~]$ vmstat 1 5\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 3  1 244208  10312   1552  62636    4   23    98   249   44  304 28  3 68  1  0\n 0  2 244920   6852   1844  67284    0  544  5248   544  236 1655  4  6  0 90  0\n 1  2 256556   7468   1892  69356    0 3404  6048  3448  290 2604  5 12  0 83  0\n 0  2 263832   8416   1952  71028    0 3788  2792  3788  140 2926 12 14  0 74  0\n 0  3 274492   7704   1964  73064    0 4444  2812  5840  295 4201  8 22  0 69  0\n&#91;user@RHEL ~]$\n<\/code><\/span><\/pre>\n\n\n<p>High IO Read Load Example<\/p>\n\n\n\n<p>A large file (such as an ISO file) will be read and written to \/dev\/null using dd.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">&#91;user@RHEL ~]$ dd <span class=\"hljs-keyword\">if<\/span>=bigfile.iso <span class=\"hljs-keyword\">of<\/span>=<span class=\"hljs-regexp\">\/dev\/<\/span><span class=\"hljs-literal\">null<\/span> bs=<span class=\"hljs-number\">1<\/span>M\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Executed in parallel, vmstat will show the increased IO read load (the bi value).<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@RHEL ~]$ vmstat 1 5\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 3  1 465872  36132  82588 1018364    7   17    70   127  214  838 12  3 82  3  0\n 0  1 465872  33796  82620 1021820    0    0 34592     0  357  781  6 10  0 84  0\n 0  1 465872  36100  82656 1019660    0    0 34340     0  358  723  5  9  0 86  0\n 0  1 465872  35744  82688 1020416    0    0 33312     0  345  892  8 11  0 81  0\n 0  1 465872  35716  82572 1020948    0    0 34592     0  358  738  7  8  0 85  0\n&#91;user@RHEL ~]$ \n<\/code><\/span><\/pre>\n\n\n<p>High IO Write Load Example<\/p>\n\n\n\n<p>In contrast with the previous example, dd will read from \/dev\/zero and write a file. The oflag=dsync will cause the data to be written immediately to the disk (and not merely stored in the page cache).<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">&#91;user@RHEL ~]$ dd <span class=\"hljs-keyword\">if<\/span>=<span class=\"hljs-regexp\">\/dev\/<\/span>zero <span class=\"hljs-keyword\">of<\/span>=<span class=\"hljs-number\">500<\/span>MBfile bs=<span class=\"hljs-number\">1<\/span>M count=<span class=\"hljs-number\">500<\/span> oflag=dsync\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Executed in parallel, vmstat will show the increased IO write load (the bo value).<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@RHEL ~]$ vmstat 1 5\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 1  1      0  35628  14700 1239164    0    0  1740   652  117  601 11  4 66 20  0\n 0  1      0  34852  14896 1239788    0    0     0 23096  300  573  3 16  0 81  0\n 0  1      0  32780  15080 1241304    0    0     4 21000  344  526  1 13  0 86  0\n 0  1      0  36512  15244 1237256    0    0     0 19952  276  394  1 12  0 87  0\n 0  1      0  35688  15412 1237180    0    0     0 18904  285  465  1 13  0 86  0\n&#91;user@RHEL ~]$ \n<\/code><\/span><\/pre>\n\n\n<p>CPU Waiting for IO Example<\/p>\n\n\n\n<p>In the following example, an updatedb process is already running. The updatedb utility is part of mlocate. It examines the entire file system and accordingly creates the database for the locate command (by means of which file searches can be performed very quickly). Because updatedb reads all of the file names from the entire file system, the CPU must wait to get data from the IO system (the hard disk). For that reason, vmstat running in parallel will display large values for wa (waiting for IO):<\/p>\n\n\n\n<p>[user@RHEL ~]$ vmstat 1 5<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 2  1 403256 602848  17836 400356    5   15    50    50  207  861 13  3 83  1  0\n 1  0 403256 601568  18892 400496    0    0  1048   364  337 1903  5  7  0 88  0\n 0  1 403256 600816  19640 400568    0    0   748     0  259 1142  6  4  0 90  0\n 0  1 403256 600300  20116 400800    0    0   476     0  196  630  8  5  0 87  0\n 0  1 403256 599328  20792 400792    0    0   676     0  278 1401  7  5  0 88  0\n&#91;user@RHEL ~]$\n<\/code><\/span><\/pre>\n\n\n<p>Additional vmstat Options<br>vmstat &#8211;help<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">&#91;user@RHEL ~]$ vmstat --help\nusage: vmstat &#91;-V] &#91;-n] &#91;delay &#91;count]]\n              -V prints version.\n              -n causes the headers not to be reprinted regularly.\n              -a <span class=\"hljs-keyword\">print<\/span> inactive\/active page stats.\n              -d prints disk statistics\n              -D prints disk table\n              -p prints disk partition statistics\n              -s prints vm table\n              -m prints slabinfo\n              -S unit size\n              delay is the delay between updates in seconds. \n              unit size k:<span class=\"hljs-number\">1000<\/span> K:<span class=\"hljs-number\">1024<\/span> m:<span class=\"hljs-number\">1000000<\/span> M:<span class=\"hljs-number\">1048576<\/span> (<span class=\"hljs-keyword\">default<\/span> is K)\n              count is the number of updates.\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>vmstat<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@fedora9 ~]$ vmstat\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 2  0  14960  38016   6584 1069284    0    1   506    81  727 1373 12  4 81  3  0\n&#91;user@fedora9 ~]$\n<\/code><\/span><\/pre>\n\n\n<p>vmstat -V<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@fedora9 ~]$ vmstat -V\nprocps version 3.2.7\n&#91;user@fedora9 ~]$\n<\/code><\/span><\/pre>\n\n\n<p>vmstat -a<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@fedora9 ~]$ vmstat -a\nprocs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st\n 3  0  14960  38024 988284 461704    0    1   506    81  726 1372 12  4 81  3  0\n&#91;user@fedora9 ~]$\n<\/code><\/span><\/pre>\n\n\n<p>vmstat -d<\/p>\n\n\n\n<p><\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@fedora9 ~]$ vmstat -d\ndisk- ------------reads------------ ------------writes----------- -----IO------\n       total merged sectors      ms  total merged sectors      ms    cur    sec\nram0       0      0       0       0      0      0       0       0      0      0\nram1       0      0       0       0      0      0       0       0      0      0\nram2       0      0       0       0      0      0       0       0      0      0\nram3       0      0       0       0      0      0       0       0      0      0\nram4       0      0       0       0      0      0       0       0      0      0\nram5       0      0       0       0      0      0       0       0      0      0\nram6       0      0       0       0      0      0       0       0      0      0\nram7       0      0       0       0      0      0       0       0      0      0\nram8       0      0       0       0      0      0       0       0      0      0\nram9       0      0       0       0      0      0       0       0      0      0\nram10      0      0       0       0      0      0       0       0      0      0\nram11      0      0       0       0      0      0       0       0      0      0\nram12      0      0       0       0      0      0       0       0      0      0\nram13      0      0       0       0      0      0       0       0      0      0\nram14      0      0       0       0      0      0       0       0      0      0\nram15      0      0       0       0      0      0       0       0      0      0\nsda   136909  31536 13893867 1197609  58190 219323 2233264 7688807      0    677\nsda1   35703   6048 1326394  511477   6728  16136  182984  419232      0    222\nsda2      85   1489    2935     653    141   3603   29952    5254      0      1\nsda3  101111  23961 12564154  685330  51321 199584 2020328 7264321      0    512\nsr0        0      0       0       0      0      0       0       0      0      0\nfd0        0      0       0       0      0      0       0       0      0      0\n<\/code><\/span><\/pre>\n\n<p>[user@fedora9 ~]<\/p>\n\n\n\n<p>vmstat -D<\/p>\n\n\n\n<p><\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@fedora9 ~]$ vmstat -D\n           22 disks \n            0 partitions \n       273820 total reads\n        63034 merged reads\n     27787446 read sectors\n      2395193 milli reading\n       116450 writes\n       438666 merged writes\n      4467248 written sectors\n     15377932 milli writing\n            0 inprogress IO\n         1412 milli spent IO\n<\/code><\/span><\/pre>\n\n\n<p>vmstat -p<\/p>\n\n\n\n<p>vmstat -p will not work under Fedora: https:\/\/bugzilla.redhat.com\/show_bug.cgi?id=485246. The following report comes from an Ubuntu 9.10 system.<\/p>\n\n\n\n<p>user@RHEL:~$ vmstat -p \/dev\/sda9<br>sda9 reads read sectors writes requested writes<br>23420 411365 24464 530801<\/p>\n\n\n\n<p>vmstat -s<\/p>\n\n\n\n<p><\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">&#91;user@fedora9 ~]$ vmstat -s\n      1553972  total memory\n      1516180  used memory\n       461892  active memory\n       988304  inactive memory\n        37792  free memory\n         6644  buffer memory\n      1069388  swap cache\n      1052248  total swap\n        14960  used swap\n      1037288  free swap\n       161467 non-nice user cpu ticks\n         7586 nice user cpu ticks\n        46310 system cpu ticks\n      1108919 idle cpu ticks\n        46832 IO-wait cpu ticks\n         2694 IRQ cpu ticks\n         2452 softirq cpu ticks\n            0 stolen cpu ticks\n      6947021 pages paged in\n      1116896 pages paged out\n          183 pages swapped in\n         3744 pages swapped out\n      9985406 interrupts\n     18852586 CPU context switches\n   1239004323 boot time\n        15072 forks\n&#91;user@fedora9 ~]$\n<\/code><\/span><\/pre>\n\n\n<p>vmstat -m<\/p>\n\n\n\n<p><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">&#91;user@fedora9 ~]$ vmstat -m\nCache                       Num  Total   Size  Pages\nfuse_request                 <span class=\"hljs-number\">11<\/span>     <span class=\"hljs-number\">11<\/span>    <span class=\"hljs-number\">368<\/span>     <span class=\"hljs-number\">11<\/span>\nfuse_inode                    <span class=\"hljs-number\">9<\/span>      <span class=\"hljs-number\">9<\/span>    <span class=\"hljs-number\">448<\/span>      <span class=\"hljs-number\">9<\/span>\nrpc_inode_cache               <span class=\"hljs-number\">8<\/span>      <span class=\"hljs-number\">8<\/span>    <span class=\"hljs-number\">512<\/span>      <span class=\"hljs-number\">8<\/span>\nnf_conntrack_expect           <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>    <span class=\"hljs-number\">168<\/span>     <span class=\"hljs-number\">24<\/span>\nnf_conntrack                 <span class=\"hljs-number\">26<\/span>     <span class=\"hljs-number\">80<\/span>    <span class=\"hljs-number\">248<\/span>     <span class=\"hljs-number\">16<\/span>\ndm_uevent                     <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>   <span class=\"hljs-number\">2464<\/span>      <span class=\"hljs-number\">3<\/span>\nUDPv6                        <span class=\"hljs-number\">22<\/span>     <span class=\"hljs-number\">22<\/span>    <span class=\"hljs-number\">704<\/span>     <span class=\"hljs-number\">11<\/span>\nTCPv6                         <span class=\"hljs-number\">6<\/span>      <span class=\"hljs-number\">6<\/span>   <span class=\"hljs-number\">1344<\/span>      <span class=\"hljs-number\">6<\/span>\nkmalloc_dma<span class=\"hljs-number\">-512<\/span>               <span class=\"hljs-number\">8<\/span>      <span class=\"hljs-number\">8<\/span>    <span class=\"hljs-number\">512<\/span>      <span class=\"hljs-number\">8<\/span>\nsgpool<span class=\"hljs-number\">-128<\/span>                   <span class=\"hljs-number\">12<\/span>     <span class=\"hljs-number\">12<\/span>   <span class=\"hljs-number\">2048<\/span>      <span class=\"hljs-number\">4<\/span>\nscsi_io_context               <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>    <span class=\"hljs-number\">104<\/span>     <span class=\"hljs-number\">39<\/span>\next3_inode_cache           <span class=\"hljs-number\">6822<\/span>   <span class=\"hljs-number\">8360<\/span>    <span class=\"hljs-number\">496<\/span>      <span class=\"hljs-number\">8<\/span>\next3_xattr                   <span class=\"hljs-number\">85<\/span>     <span class=\"hljs-number\">85<\/span>     <span class=\"hljs-number\">48<\/span>     <span class=\"hljs-number\">85<\/span>\njournal_handle              <span class=\"hljs-number\">170<\/span>    <span class=\"hljs-number\">170<\/span>     <span class=\"hljs-number\">24<\/span>    <span class=\"hljs-number\">170<\/span>\njournal_head                 <span class=\"hljs-number\">76<\/span>    <span class=\"hljs-number\">219<\/span>     <span class=\"hljs-number\">56<\/span>     <span class=\"hljs-number\">73<\/span>\nrevoke_record               <span class=\"hljs-number\">256<\/span>    <span class=\"hljs-number\">256<\/span>     <span class=\"hljs-number\">16<\/span>    <span class=\"hljs-number\">256<\/span>\nflow_cache                    <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>     <span class=\"hljs-number\">80<\/span>     <span class=\"hljs-number\">51<\/span>\nbsg_cmd                       <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>    <span class=\"hljs-number\">288<\/span>     <span class=\"hljs-number\">14<\/span>\nmqueue_inode_cache            <span class=\"hljs-number\">7<\/span>      <span class=\"hljs-number\">7<\/span>    <span class=\"hljs-number\">576<\/span>      <span class=\"hljs-number\">7<\/span>\nisofs_inode_cache             <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>    <span class=\"hljs-number\">376<\/span>     <span class=\"hljs-number\">10<\/span>\nhugetlbfs_inode_cache        <span class=\"hljs-number\">11<\/span>     <span class=\"hljs-number\">11<\/span>    <span class=\"hljs-number\">344<\/span>     <span class=\"hljs-number\">11<\/span>\ndquot                         <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>    <span class=\"hljs-number\">128<\/span>     <span class=\"hljs-number\">32<\/span>\nshmem_inode_cache          <span class=\"hljs-number\">1058<\/span>   <span class=\"hljs-number\">1071<\/span>    <span class=\"hljs-number\">448<\/span>      <span class=\"hljs-number\">9<\/span>\nxfrm_dst_cache                <span class=\"hljs-number\">0<\/span>      <span class=\"hljs-number\">0<\/span>    <span class=\"hljs-number\">320<\/span>     <span class=\"hljs-number\">12<\/span>\nUDP                          <span class=\"hljs-number\">19<\/span>     <span class=\"hljs-number\">21<\/span>    <span class=\"hljs-number\">576<\/span>      <span class=\"hljs-number\">7<\/span>\nTCP                          <span class=\"hljs-number\">17<\/span>     <span class=\"hljs-number\">24<\/span>   <span class=\"hljs-number\">1216<\/span>      <span class=\"hljs-number\">6<\/span>\nblkdev_queue                 <span class=\"hljs-number\">21<\/span>     <span class=\"hljs-number\">21<\/span>   <span class=\"hljs-number\">1080<\/span>      <span class=\"hljs-number\">7<\/span>\nbiovec<span class=\"hljs-number\">-256<\/span>                    <span class=\"hljs-number\">2<\/span>      <span class=\"hljs-number\">2<\/span>   <span class=\"hljs-number\">3072<\/span>      <span class=\"hljs-number\">2<\/span>\nbiovec<span class=\"hljs-number\">-128<\/span>                    <span class=\"hljs-number\">5<\/span>      <span class=\"hljs-number\">5<\/span>   <span class=\"hljs-number\">1536<\/span>      <span class=\"hljs-number\">5<\/span>\nbiovec<span class=\"hljs-number\">-64<\/span>                     <span class=\"hljs-number\">7<\/span>     <span class=\"hljs-number\">10<\/span>    <span class=\"hljs-number\">768<\/span>      <span class=\"hljs-number\">5<\/span>\nsock_inode_cache            <span class=\"hljs-number\">619<\/span>    <span class=\"hljs-number\">650<\/span>    <span class=\"hljs-number\">384<\/span>     <span class=\"hljs-number\">10<\/span>\nfile_lock_cache              <span class=\"hljs-number\">39<\/span>     <span class=\"hljs-number\">39<\/span>    <span class=\"hljs-number\">104<\/span>     <span class=\"hljs-number\">39<\/span>\nAcpi-Operand               <span class=\"hljs-number\">2935<\/span>   <span class=\"hljs-number\">2958<\/span>     <span class=\"hljs-number\">40<\/span>    <span class=\"hljs-number\">102<\/span>\nAcpi-<span class=\"hljs-keyword\">Namespace<\/span>             1700   1700     24    170\n<span class=\"hljs-title\">Cache<\/span>                       <span class=\"hljs-title\">Num<\/span>  <span class=\"hljs-title\">Total<\/span>   <span class=\"hljs-title\">Size<\/span>  <span class=\"hljs-title\">Pages<\/span>\n<span class=\"hljs-title\">taskstats<\/span>                    25     26    312     13\n<span class=\"hljs-title\">proc_inode_cache<\/span>            233    242    360     11\n<span class=\"hljs-title\">sigqueue<\/span>                     28     28    144     28\n<span class=\"hljs-title\">radix_tree_node<\/span>            7888   8606    296     13\n<span class=\"hljs-title\">bdev_cache<\/span>                   24     24    512      8\n<span class=\"hljs-title\">inode_cache<\/span>                 370    462    344     11\n<span class=\"hljs-title\">dentry<\/span>                     6592  15390    136     30\n<span class=\"hljs-title\">names_cache<\/span>                   2      2   4096      2\n<span class=\"hljs-title\">avc_node<\/span>                     73     73     56     73\n<span class=\"hljs-title\">selinux_inode_security<\/span>     9888  10030     48     85\n<span class=\"hljs-title\">idr_layer_cache<\/span>             627    644    144     28\n<span class=\"hljs-title\">buffer_head<\/span>                2308   2688     64     64\n<span class=\"hljs-title\">mm_struct<\/span>                   659    693    448      9\n<span class=\"hljs-title\">vm_area_struct<\/span>            11110  11592     88     46\n<span class=\"hljs-title\">files_cache<\/span>                 115    130    384     10\n<span class=\"hljs-title\">sighand_cache<\/span>               141    150   1344      6\n<span class=\"hljs-title\">task_struct<\/span>                 246    248   3696      2\n<span class=\"hljs-title\">anon_vma<\/span>                   4778   5120     16    256\n<span class=\"hljs-title\">kmalloc<\/span>-4096                 95    112   4096      8\n<span class=\"hljs-title\">kmalloc<\/span>-2048                272    304   2048     16\n<span class=\"hljs-title\">kmalloc<\/span>-1024                518    524   1024      4\n<span class=\"hljs-title\">kmalloc<\/span>-512                 764    888    512      8\n<span class=\"hljs-title\">kmalloc<\/span>-256                 198    208    256     16\n<span class=\"hljs-title\">kmalloc<\/span>-128                 629    832    128     32\n<span class=\"hljs-title\">kmalloc<\/span>-64                 4322   5568     64     64\n<span class=\"hljs-title\">kmalloc<\/span>-32                 1554   1664     32    128\n<span class=\"hljs-title\">kmalloc<\/span>-16                 2644   3584     16    256\n<span class=\"hljs-title\">kmalloc<\/span>-8                  3561   3584      8    512\n<span class=\"hljs-title\">kmalloc<\/span>-192                6349   6930    192     21\n<span class=\"hljs-title\">kmalloc<\/span>-96                  885   1176     96     42\n&#91;<span class=\"hljs-title\">user<\/span>@<span class=\"hljs-title\">fedora9<\/span> ~]$ <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>","protected":false},"excerpt":{"rendered":"<p>The vmstat command (short for virtual memory statistics) is a built-in monitoring utility in Linux. Users can observe system activity virtually in real-time by specifying a sampling period. The command helps you identify performance bottlenecks and diagnose problems in your system. The command is used to obtain information about following memory, system processes, paging, interrupts,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":31534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[4957],"tags":[378,632,460,1280,169,1277,1278,1279,1282,1281],"class_list":["post-463","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-commands","tag-examples","tag-linux","tag-linux-vmstat-command","tag-unix","tag-vmstat","tag-vmstat-command","tag-vmstat-command-examples","tag-vmstat-command-line","tag-vmstat-commands-tutorials"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=463"}],"version-history":[{"count":9,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/463\/revisions"}],"predecessor-version":[{"id":31541,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/463\/revisions\/31541"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/31534"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}