Skip to content

Instantly share code, notes, and snippets.

@kittinan
Created April 20, 2020 07:07
Show Gist options
  • Save kittinan/69535efa2479c3d5442f990602edca6b to your computer and use it in GitHub Desktop.
Save kittinan/69535efa2479c3d5442f990602edca6b to your computer and use it in GitHub Desktop.
Ubuntu 18.04 create swap
#!/bin/bash
# Run as root
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
sysctl vm.swappiness=10
echo "vm.swappiness=10" >> /etc/sysctl.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment