Linux add swap partition, set swap threshold value

Source: Internet
Author: User


Swap threshold Value Setting

1. Check the current system swap threshold [email protected]~$ CAT/PROC/SYS/VM/SWAPPINESS60 memory when used to 100-60=40%, the use of switched partitions begins to appear swappiness= 0 indicates the maximum use of physical memory before using swap space, swappiness=100 indicates active use of the swap partition, and the memory of the data in a timely manner into the swap space 2, permanent settings [email protected]~$ sudo-s[[ Email protected] chunli]# echo "vm.swappiness = ten" >>/etc/sysctl.conf #永久修改 [email protected]~$ sudo sysctl-p[e Mail protected]~$ cat/proc/sys/vm/swappiness103, temporary settings [email protected]~$ sudo sysctl vm.swappiness=10 #临时修改


Create a Swap partition file

[email protected]~$ dd if=/dev/zero of=swapfile bs=1m count=4096[email  Protected]~$ mkswap swapfile enable swap partition [Email protected]~$ sudo swapon swapfile[email  protected]~$ free -mt              total       used       free      shared    buffers     cachedMem:            497         490          6           0         19         247-/+ buffers/cache:        224         272Swap:         6111           0       6111Total:         6609        490        6118 closing the swap partition [email protected]~$ sudo swapoff swapfile [email protected]~$  free -m             total        used       free      shared    buffers     cachedMem:            497        488           8          0          19        247-/+ buffers/cache:         221        275Swap:          2015           0       2015 permanent settings, boot automatic mountvim /etc/fstab /swapfile                swap                     swap     defaults        0 0




This article is from the "Soul Bucket" blog, please be sure to keep this source http://990487026.blog.51cto.com/10133282/1903723

Linux add swap partition, set swap threshold value

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.