Created
June 27, 2015 07:25
-
-
Save cobyism/58f5463869aaf84184f0 to your computer and use it in GitHub Desktop.
Commands to create swapfile on a Digital Ocean Ubuntu droplet
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
sudo fallocate -l 2G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
swapon -s | |
free -m |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @cobyism ,
How may I permanently add the swap file in my system?
Now I'm facing the problem is If I restart or shutdown the server the swap file remove or does not run! Then I have to have need re-create the swap file as your command.
Thanks