Skip to content

Instantly share code, notes, and snippets.

@noodny
Created June 2, 2015 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noodny/d1eea1d5d6c3a7c20492 to your computer and use it in GitHub Desktop.
Save noodny/d1eea1d5d6c3a7c20492 to your computer and use it in GitHub Desktop.
DigitalOcean swap file
# 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