Last active
May 16, 2022 04:53
-
-
Save namgivu/db3c1260a36621eef5858e310577ca8c 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
increase swap file size to 8Gb | |
ref. https://askubuntu.com/a/1075516/22308 | |
```bash | |
sudo swapoff /swapfile ; _='# make all swap off'; | |
sudo rm -rf /swapfile ; _='# remove the current'; | |
_='# 16*1024Mb=16384Mb | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=16384 ; _='# set swapfile size to 16Gb'; | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 ; _='# set swapfile size to 8Gb'; | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096 ; _='# set swapfile size to 4Gb'; | |
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048 ; _='# set swapfile size to 2Gb'; | |
sudo chmod 600 /swapfile; | |
sudo mkswap /swapfile ; _='# format the file as swap'; | |
sudo swapon /swapfile ; _='# activate it'; | |
sudo swapon -s ; _='# view swap size'; | |
``` | |
turn on swap as it may turned off when reboot as discussed here https://askubuntu.com/q/1166170/22308 | |
```bash | |
# open editor for crontab | |
sudo crontab -e | |
: add below lines | |
# turn on swap file ref. https://superuser.com/a/586078/34893 | |
@reboot /sbin/swapon /swapfile | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment