Skip to content

Instantly share code, notes, and snippets.

@BitOfUniverse
Created September 7, 2016 08:59
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 BitOfUniverse/88a9b70f2376211c82fc8fa3d5805f0e to your computer and use it in GitHub Desktop.
Save BitOfUniverse/88a9b70f2376211c82fc8fa3d5805f0e to your computer and use it in GitHub Desktop.
Create SWAP file (1Gb)
# Base on this article: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
# Make the Swap File Permanent
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# Update swappiness
# For a Desktop, a swappiness setting of 60 is not a bad value. For a server, you might want to move it closer to 0.
sudo sysctl vm.swappiness=10
sudo echo vm.swappiness=10 >> /etc/sysctl.conf
# Adjusting the Cache Pressure Setting
sudo sysctl vm.vfs_cache_pressure=50
sudo 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