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