Created
March 9, 2020 09:14
-
-
Save bard86/6143fcbcf959d5546938a2c49f642d49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
free -h | |
sudo fallocate -l 2G /swapfile | |
ls -lh /swapfile | |
sudo chmod 600 /swapfile | |
sudo swapon /swapfile | |
free -h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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