Skip to content

Instantly share code, notes, and snippets.

@joseramonc
Created June 9, 2017 15:53
Show Gist options
  • Save joseramonc/62a52616602db6e0d14c1aa10f0e7afb to your computer and use it in GitHub Desktop.
Save joseramonc/62a52616602db6e0d14c1aa10f0e7afb to your computer and use it in GitHub Desktop.
Add swap into ubuntu
# bin/bash
# Has configured swap?
# sudo swapon -s
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo nano /etc/fstab
# persist between reboots, add this line at the bottom:
# /swapfile none swap sw 0 0
sudo sysctl vm.swappiness=10
sudo nano /etc/sysctl.conf
# add at the bottom:
# vm.swappiness=10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment