Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux basic command-vmstat displays the status of virtual memory

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Vmstat

The vmstat instruction is used to display the status of virtual memory usage, as well as process and cpu activity. Vmstat reports information about processes, memory, paging, block IO, traps, and CPU activity. The first report generated gives the average since the last restart. Other reports provide information on the length of the delayed sampling period. In both cases, process and memory reports are instantaneous.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora, SUSE, openSUSE.

1. Grammar

Vmstat [- a] [- n] [- t] [- S unit] [delay [count]]

Vmstat [- s] [- n] [- S unit]

Vmstat [- m] [- n] [delay [count]]

Vmstat [- d] [- n] [delay [count]]

Vmstat [- p disk partition] [- n] [delay [count]]

Vmstat [- f]

Vmstat [- V]

2. List of options

Option

Description

-a

Displays the status of used and unused virtual memory

-f

Show the usage of fork after power on

-t

Add timestamp to output

-m

Display slab information

-n

Display header information once instead of intermittent display

-d

Show disk usage

-w

-w increases the field width of large memory.

-p

-p followed by some partition names for detailed statistics (required kernel 2.5.70 or higher)

-S

Sets the unit of capacity. But k, K, m and M stand for 1000, 1024, 1000000, 1048576 bytes, respectively.

-V

Display version information

3. Field description of VM mode

1) Proc

R: the number of processes waiting to run; b: the number of processes in uninterrupted sleep.

2) Memory

Swpd: amount of virtual memory used; free: amount of free memory; amount of memory used by buff:buffer cache; amount of memory used by cache:chace cache; incat: amount of inactive memory; active: amount of active memory

3) Swap

Si: the amount of memory swapped from disk (/ s); so: the amount of memory swapped to disk (/ s).

4) IO

Bi: a block received from a block device (block / s); bo: a block sent to a block device (block / s).

5) System

In: number of interrupts per second, including the clock. ; cs: the number of context switches per second.

6) CPU

Us: the time spent running non-kernel code. (user time, including good time); sy: time to run kernel code. (system time); id: idle time (before Linux2.5.41, this includes IO- wait time); wa: time waiting for IO (included in idle before Linux2.5.41); st: time stolen from the virtual machine (unknown before Linux 2.6.11).

4. Field description of disk mode

1) Reads

Total: total number of reads completed successfully; merged: packet reads (resulting in an Icano); sectors: sectors successfully read; ms: milliseconds read.

2) Writes

Total: total number of writes completed successfully; merged: block writes (resulting in an Icano); sectors: successfully written to the sector; ms: milliseconds written.

3) IO

Cur: the number of seconds of s:IO in progress.

5. Field description of disk partition mode

Reads: the total number of reads issued to this partition; read sectors: the total number of read sectors for the partition; writes: the total number of writes issued to this partition; request writes: the total number of sectors written to the partition.

6. Fields of slab mode

Cache: name of cache; num: number of currently active objects; total: total number of objects available; size: size of each object; pages: number of pages with at least one active object; totpages: total number of pages allocated; pslab: number of pages per slab.

7. Description

Vmstat does not require special permissions. These reports are designed to help identify system bottlenecks. Linux vmstat does not see itself as a running process. All Linux blocks are currently 1024 bytes. The old kernel could report blocks as 512 bytes, 2048 bytes, or 4096 bytes. Because the prps 3.1.9 meme vmstat allows you to select units in the default mode (kmae Kpenm M) defaults to K (1024 bytes). Vmstat uses slabinfo 1.1 patch

8. Examples

1) display virtual memory usage

[root@localhost ntop-4.0.1] # vmstat-a

Procs-memory--swap---io-----system---cpu-

R b swpd free inact active si so bi bo in cs us sy id wa st

00 0 336892 371548 811616 00 5 5 97 47 00 100 00

You have new mail in / var/spool/mail/root

[root@localhost ntop-4.0.1] #

2) display the usage of fork after boot

[root@localhost ntop-4.0.1] # vmstat-f / / shows the number of fork after boot

21739 forks

[root@localhost ntop-4.0.1] #

3) display disk information

[root@localhost ntop-4.0.1] # vmstat-d / / display disk information

Disk--reads--writes--IO-

Total merged sectors ms total merged sectors ms cur sec

Ram0 0 0 0

Ram1 0 0 0

Ram2 0 0 0

Ram3 0 0 0

Ram4 0 0 0

Ram5 0 0 0

Ram6 0 0 0

Ram7 0 0 0

Ram8 0 0 0

Ram9 0 0 0

Ram10 0 0 0

Ram11 0 0 0

Ram12 0 0 0

Ram13 0 0 0

Ram14 0 0 0

Ram15 0 0 0

Loop0 0 0 0

Loop1 0 0 0

Loop2 0 0 0

Loop3 0 0 0

Loop4 0 0 0

Loop5 0 0 0

Loop6 0 0 0

Loop7 0 0 0

Sr0 56 45 404 30 0 0 0

Sda 43369 21298 1817706 37136 94895 126742 1685748 129957 0 114

Dm-0 63405 0 1808002 66652 210875 0 1685664 552283 0 114

Dm-1 322 0 2576 317 0 0 0

[root@localhost ntop-4.0.1] #

A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.

Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report