Created
July 19, 2017 07:12
-
-
Save yigitozkavci/7ebeef5e29712018875f9f29499c81d8 to your computer and use it in GitHub Desktop.
Add and configure swap space on ubuntu
This file contains hidden or 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
SWAP_SIZE="1G" # Generally x1 or x2 of your memory is sufficient | |
sudo fallocate -l "$SWAP_SIZE" /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf | |
echo 'vm.vfs_cache_pressure=50' | sudo tee -a /etc/sysctl.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment