Skip to content

Instantly share code, notes, and snippets.

@bitamar
Last active February 7, 2016 08:11
Show Gist options
  • Save bitamar/83075ab2901601a40c0f to your computer and use it in GitHub Desktop.
Save bitamar/83075ab2901601a40c0f to your computer and use it in GitHub Desktop.
Add swap to ubuntu 14.04
# Add a 1G swap to swapless ubuntu server. (Verify with: free -m)
# Adapted from https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sysctl vm.swappiness=10
echo vm.swappiness=10 >> /etc/sysctl.conf
sysctl vm.vfs_cache_pressure=50
echo vm.vfs_cache_pressure=50 >> /etc/sysctl.conf
free -m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment