Created
April 20, 2020 07:07
-
-
Save kittinan/69535efa2479c3d5442f990602edca6b to your computer and use it in GitHub Desktop.
Ubuntu 18.04 create swap
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 | |
# 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