Linux/Swap: Difference between revisions
< Linux
(Created page with " Category:Linux/System Category:Linux") |
mNo edit summary |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Status == | |||
<pre> | |||
sudo swapon --show | |||
free -m | |||
</pre> | |||
== Create swapfile == | |||
<pre> | |||
sudo fallocate -l 4G /swapfile | |||
sudo chmod 600 /swapfile | |||
sudo mkswap /swapfile | |||
sudo swapon /swapfile | |||
</pre> | |||
== Add to /etc/fstab == | |||
<pre> | |||
/swapfile none swap sw 0 0 | |||
</pre> | |||
== Change swappiness == | |||
<pre> | |||
cat /proc/sys/vm/swappiness | |||
sudo sysctl vm.swappiness=10 | |||
</pre> | |||
* /etc/sysctl.conf | |||
<pre> | |||
vm.swappiness=10 | |||
</pre> | |||
[[Category:Linux/System]] | [[Category:Linux/System]] | ||
[[Category:Linux]] | [[Category:Linux]] |
Latest revision as of 22:50, 19 November 2023
Status
sudo swapon --show free -m
Create swapfile
sudo fallocate -l 4G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
Add to /etc/fstab
/swapfile none swap sw 0 0
Change swappiness
cat /proc/sys/vm/swappiness sudo sysctl vm.swappiness=10
- /etc/sysctl.conf
vm.swappiness=10