Cloud Server ECS Linux SWAP configuration

Source: Internet
Author: User
Cloud Server Swap Configuration

One, create a file for the swap partition:
dd if=/dev/zero of=/opt/swap bs=1M count=8192

Two, set the swap partition file:
mkswap /opt/swap

Third, enable swap partition files now
swapon /opt/swap

Four, view swap partitions
swapon -s

Five, set the SWAP partition to be self-enabled when booting:
Vim/etc/fstab
/opt/swap swap swap defaults 0 0

Six, modify the swpapiness parameter
When the value of the swappiness content is 0 o'clock, the SWAP partition is used when the physical memory is used to maximize physical memory. When the value of the swappiness content is 100, the swap partition is actively used, and the in-memory data is replaced in a timely manner to the swap partition.

Currently in effect settings
echo 10 > /proc/sys/vm/swappiness

Permanent Entry Settings
Vim/etc/sysctl.conf
vm.swappiness=10

Close swap operation
Currently closed
swapoff /mnt/swap

Permanently closed
Vim/etc/fstab
#/opt/swap swap swap defaults 0 0

Cloud Server ECS Linux SWAP configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.