Created
June 2, 2015 19:45
-
-
Save noodny/d1eea1d5d6c3a7c20492 to your computer and use it in GitHub Desktop.
DigitalOcean swap file
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
# create a swapfie | |
sudo fallocate -l 1G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
# make it permanent | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
# tweak it | |
echo "vm.swappiness=10" >> /etc/sysctl.conf | |
echo "vm.vfs_cache_pressure = 50" >> /etc/sysctl.conf | |
# reboot and check if it worked | |
reboot | |
sudo swapon -s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment