Created
February 2, 2019 10:02
-
-
Save dafonso/fb053dfcd63bc99434eb6c67666a5312 to your computer and use it in GitHub Desktop.
Add swap to a Digital Ocean droplet
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
rm -f /swapfile | |
# create swap file - adjust swapfile size to droplet memory | |
fallocate -l 1024M /swapfile | |
# make it swap | |
mkswap /swapfile | |
# chmod it accordingly | |
chmod 600 /swapfile | |
# enable swap | |
swapon /swapfile | |
# add it to fstab to be mounted on reboot | |
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment