Created
February 27, 2023 07:28
-
-
Save sofianhw/7d31762c64f43a9a7e4efa718acaccca to your computer and use it in GitHub Desktop.
swap-linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make swapfile | |
sudo fallocate -l 2G /swapfile | |
sudo chmod 600 /swapfile | |
# mark as swap space | |
sudo mkswap /swapfile | |
# enable swap file | |
sudo swapon /swapfile | |
# make it permanent | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
# adjust swappiness /etc/sysctl.conf | |
echo 'vm.swappiness=25' | sudo tee -a /etc/sysctl.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment