Last active
January 6, 2017 06:55
-
-
Save avishaan/ab1d03aba923fdb8b29dfc9ccc3a11a5 to your computer and use it in GitHub Desktop.
Create swapfile on
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
#!/bin/bash | |
#https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04 | |
sudo fallocate -l 2G /swapfile | |
ls -lh /swapfile | |
chmod 0600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo swapon --show | |
sudo cp /etc/fstab /etc/fstab.bak | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
sudo sysctl vm.swappiness=30 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment