View modify the Linux SWAP size

 

1 See swap space (Total):
     # default unit of Free -m k, -m units M
                 Total Used Free Shared buffers cached
  Mem: 0. 19 110 197 377 180 [
  - / + buffers / Cache: 50 327
  Swap: 572 0 572
 
 
 
2 View swap space (file (s) / partition ( s)):
 
      includes detailed information and file partition
 
  # swapon -s
  equivalent to
  # cat / proc / swaps
 
 
 

3 Add swap space
  two choices: add a swap partition or add a swap file. It recommended that you add a swap partition; however, if you do not have much free space is available, then add the swap file.
 
    3.1 Adding a swap partition
  steps:
      A Using fdisk to create a swap partition (assuming / dev / sdb2 swap partition created)
      B using mkswap command to set the swap partition:
   # mkswap / dev / sdb2
      C to enable swap:
   # the swapon / dev / sdb2
      D write / etc / fstab, to enable the boot:
      / dev / sdb2 the swap the swap Defaults 0 0
 
    3.2 a swap file to add
  a 512M created for the swap file size:
   # dd IF = / dev / ZERO of = / swapfile1 1024K COUNT = 512 BS =
  B using mkswap command to set the swap file:
   # mkswap / swapfile1
  C swap enabled:
   # the swapon / swapfile1
  D write / etc / fstab, to enable the boot:
    / swapfile1 the swap the swap Defaults 0 0
 
  after added a new swap partition and activate it, check cat / proc swaps output / or free command to ensure that the swap has been enabled.
 
4 Delete the swap space:
  A disabled swap partition:
   # swapoff / dev / sdb2
  b remove items from the / etc / fstab in;
  c use fdisk or yast tool to delete the partition.
 
  Delete the swap file steps above.
 
 
 
-------------------------------------------------- ------------------------------

 
 
 
 
  Free -m #
                 Total Used Free Shared buffers cached
  Mem: 0. 19 110 197 377 180 [
  - / + buffers / Cache: 50 327
  Swap: 572 0 572
 
 
 
Mem line shows the case where the system from the point of view of memory usage, total system is available memory size equal to the number of memory system kernel reserves physical memory minus the
buffers are cached and the system memory used as a buffer. buffers associated with a block device, comprising the file system metadata, and track changes in the block. cache contains only the file itself.

- / + buffers / cache line information from the user point of display memory, available memory is equal to minus the used column mem row buffers and cached memory size from the number.
 
 Because buffers and cached to speed up the operating system and operating system settings, when the user needs, you can only access for users to use.

 
 
Each process dynamic top show the system is running, real-time status (CPU, RAM)
 
top there are three columns VIRT RES SHR, designates memory condition used by the process.
total memory size may be used VIRT identifies the process, including the process the use of real memory, the mapped files, and other processes to share memory and so on.
RES this process identifies the real size of memory occupied.
SHR and other process can identify shared memory and database size.

vmstat display memory usage
 
These commands are read memory information from / proc / meminfo in.
 
on the meaning / proc / meminfo in each row, are described in the kernel source Documentation / filesystems / proc.txt file
 
of the real system memory size can dmesg | grep [mM] [eE ] [mM] see
 
/ proc / pid / status display state of a detailed process
# CAT / proc / 5346 / status
the Name: the bash
state: S (Sleeping)
SleepAVG: 98 %
TGID: 5346
the Pid: 5346
PPID: 5343
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 104 104 104 104
FDSize: 256
Groups:. 6 24 29 44 is 104 113 1000 1001
VmPeak: 6528 kB
VmSize: 6528 kB
VmLck: 0 kB
VmHWM: 1976 kB
VmRSS: 1976 kB
VmData: 752 kB
VmStk: 84 kB
VmExe: 644 kB
vmLib: 1788 kB
VmPTE: 16 kB
Threads: 1
SigQ: 0/4294967295
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000384004
SigCgt: 000000004b813efb
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000

VIRT VmSize shall be consistent with the overall process memory size, and the top
output. ----------------
Copyright: This article is CSDN blogger "Baby 2355" in the original article, follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/sdfsdkk/article/details/83834492

Guess you like

Origin www.cnblogs.com/ExMan/p/11586769.html
Recommended