Skip to content

Instantly share code, notes, and snippets.

@jdiamond
Created June 2, 2015 17:49
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 jdiamond/361eaadb18d43fcaeb8c to your computer and use it in GitHub Desktop.
Save jdiamond/361eaadb18d43fcaeb8c to your computer and use it in GitHub Desktop.
Enable swapfile on Ubuntu
# create the swapfile:
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
# enable it:
swapon /swapfile
sysctl vm.swappiness=10
sysctl vm.vfs_cache_pressure=50
# make it permanent:
echo '/swapfile none swap sw 0 0' >> /etc/fstab
echo 'vm.swappiness=10' >> /etc/sysctl.conf
echo 'vm.vfs_cache_pressure=50' >> /etc/sysctl.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment