Last active
November 17, 2019 03:11
-
-
Save afeijo/0da54f9c5f87744329aa16cd23cb759f to your computer and use it in GitHub Desktop.
This file contains 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
# this works for debian, ubuntu and similar | |
sudo fallocate -l 2G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo cp /etc/fstab /etc/fstab.bak | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To assign the swapfile size with the same RAM total size:
sudo fallocate -l $(grep MemTotal /proc/meminfo | awk '{print $2}')000 /swapfile