Last active
February 27, 2023 10:07
-
-
Save nghialuffy/c1a4c154a2cddfad106ed870f1b0c6d1 to your computer and use it in GitHub Desktop.
How to increase swap space?
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
sudo sysctl vm.swappiness=50 | |
## Change forever | |
> vi /etc/sysctl.conf | |
vm.swappiness=40 | |
> sysctl -p |
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
# Turn swap off | |
# This moves stuff in swap to the main memory and might take several minutes | |
sudo swapoff -a | |
# Create an empty swapfile | |
# Note that "1G" is basically just the unit and count is an integer. | |
# Together, they define the size. In this case 8GB. | |
sudo dd if=/dev/zero of=/swapfile bs=1G count=8 | |
# Set the correct permissions | |
sudo chmod 0600 /swapfile | |
sudo mkswap /swapfile # Set up a Linux swap area | |
sudo swapon /swapfile # Turn the swap on | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment