Last active
June 4, 2020 10:11
-
-
Save morshadunnur/5c917f7aa2b5d28a9a4b062bd7ea41f4 to your computer and use it in GitHub Desktop.
Swap disk ubuntu
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 fallocate -l 1G /swapfile | |
ls -lh /swapfile | |
sudo chmod 600 /swapfile | |
ls -lh /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo swapon --show | |
We can change this by adding the swap file to our /etc/fstab file. | |
Back up the /etc/fstab file in case anything goes wrong: | |
sudo cp /etc/fstab /etc/fstab.bak | |
You can add the swap file information to the end of your /etc/fstab file by typing: | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
cat /proc/sys/vm/swappiness | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment