Skip to content

Instantly share code, notes, and snippets.

@Granga
Forked from igorbarinov/digitalocean add swap
Created January 5, 2018 02:40
Show Gist options
  • Select an option

  • Save Granga/d19dbbf795e4211d8e9ea23c116f9cc8 to your computer and use it in GitHub Desktop.

Select an option

Save Granga/d19dbbf795e4211d8e9ea23c116f9cc8 to your computer and use it in GitHub Desktop.
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon -s
sudo sh -c "printf '/swapfile none swap sw 0 0\n' >> /etc/fstab"
sudo sh -c "printf 'vm.swappiness=10\n' >> /etc/sysctl.conf"
sudo sysctl vm.vfs_cache_pressure=50
sudo sh -c "printf 'vm.vfs_cache_pressure = 50\n' >> /etc/sysctl.conf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment