Skip to content

Instantly share code, notes, and snippets.

@stansidel
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stansidel/8840630 to your computer and use it in GitHub Desktop.
Save stansidel/8840630 to your computer and use it in GitHub Desktop.
Activate swap file on Ubuntu (based on the tutorial for DigitalOcean - https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04)
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024k
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile none swap sw 0 0 " | sudo tee -a /etc/fstab
echo 0 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 0 | sudo tee -a /etc/sysctl.conf
sudo chown root:root /swapfile
sudo chmod 0600 /swapfile
swapon -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment