Skip to content

Instantly share code, notes, and snippets.

@josuebasurto
Last active October 10, 2017 19:53
Show Gist options
  • Select an option

  • Save josuebasurto/2a65e4bf565c7e6ed826151f5c75a9f1 to your computer and use it in GitHub Desktop.

Select an option

Save josuebasurto/2a65e4bf565c7e6ed826151f5c75a9f1 to your computer and use it in GitHub Desktop.
Swapfile on Ubuntu

List of commands

sudo apt-get update

sudo apt-get upgrade

sudo swapon -s

free -m

sudo swapon -s

df -h

sudo fallocate -l 4G /swapfile

ls -lh /swapfile

sudo chmod 600 /swapfile

ls -lh /swapfile

sudo mkswap /swapfile

sudo swapon /swapfile

sudo swapon -s

free -m

sudo nano /etc/fstab

cat /proc/sys/vm/swappiness

sudo sysctl vm.swappiness=10

sudo sysctl vm.vfs_cache_pressure=50

Additional

sudo nano /etc/sysctl.conf

Reference

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment