Add linux server virtual memory details for changes to swap exchange area

Because many servers were not set up for exchange swap or because the set-up was too small

Some sites are fasting, and they fill up the web server’s memory. So it is necessary to increase virtual memory exchange areas!

swap partition size description

In general, swap size can be set according to the following rules: physical memory within 4G, with SWAP setting twice as much as memory. Physical memory within 4-8G, SWAP is equal to memory size. Physical memory within 8-64G, SWAP set at 8G. Physical memory within 64-256G, SWAP set at 16G. In practice, the size of a system exchange partition does not depend on the amount of physical memory, but rather on the load of memory in the system, so that the SWAP values are set for specific operations when installed.

If you add a pre-exchange area 1G

Add swap exchange partition space

View current memory and swap spatial size $free-mh 2. Create swap exchange partition file/swap/swapfile, 8G US$ sudo mkdir /swap if?subd=/dev/zero of=/swap/swapfile bs=1G country=8. Formatted swap subdivision: $sudo mkswap/swap/swapfile 4./swap/swapfile 5. Amend permissions: $sudo schmod 600/swap/swap/swapiile 6. Activate swapt: $sudo swapon/swap/swapfile is installed for automatic access to the switch: $usuve/etc/fstab adds the following changes at the bottom of this document:

Attach: delete swap exchange partition

1. Discontinuation of swap partitions: $sudo swapoff/swap/swapfile 2. Delete swap partition files: $suo rm / swap/swap file 3. Delete or comment on the following automatic mount in /etc/fstab document: /swap/swap swap swap defaault 0

Note: If this step of formatting swap sub-division is to be implemented, there are problems that cannot be activated.

Virtual memory operation for centos

First remove the previous virtual memory swapon -s search for virtual memory mount positions / var/swapd file 3145724 619776-2 /dev/sda2 party 8388604 0-3 use commands swapoff to close virtual memory /sbin/swapoff / var/swapd rm-rf / dev/sda2 rm-rif / var/ swapdsbin/swapoff /Dev/sda2 returns without file

nano /etc/fstab delete mount with ## comment to remove the line code plus #/Dev/Sda2 swap swap defaults 0 0

Finally reboot restart!

Author: Ziqi Source View

未经允许不得转载:萌萌Apprentissage » Add linux server virtual memory details for changes to swap exchange area

Like (0) 打赏

Comments 0

Protected with IP Blacklist CloudIP Blacklist Cloud
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

//下一个脚本特效
//下一个脚本