Skip to content

Instantly share code, notes, and snippets.

@bard86
Created March 9, 2020 09:14
Show Gist options
  • Save bard86/6143fcbcf959d5546938a2c49f642d49 to your computer and use it in GitHub Desktop.
Save bard86/6143fcbcf959d5546938a2c49f642d49 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
free -h
sudo fallocate -l 2G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile
free -h
@bard86
Copy link
Author

bard86 commented May 23, 2020

sudo swapon --show
sudo fallocate -l 1G /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
sudo swapon --show
sudo free -h
sudo 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