Skip to content

Instantly share code, notes, and snippets.

@YeeJiaWei
Forked from namgivu/ubuntu-make-swap-file.sh
Created January 19, 2023 07:27
Show Gist options
  • Save YeeJiaWei/2eb4e22c4df23a2b263f3fc95ef05bbb to your computer and use it in GitHub Desktop.
Save YeeJiaWei/2eb4e22c4df23a2b263f3fc95ef05bbb to your computer and use it in GitHub Desktop.
increase swap file size to 8Gb
# ref. https://askubuntu.com/a/1075516/22308
sudo swapoff /swapfile # make all swap off
sudo rm -rf /swapfile # remove the current
# 8*1024Mb=8192Mb
sudo dd if=/dev/zero of=/swapfile bs=1M count=8192 # resize the swapfile to 8Gb
sudo chmod 600 /swapfile
sudo mkswap /swapfile # format the file as swap
sudo swapon /swapfile # activate it
sudo swapon -s # view swap size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment