Skip to content

Instantly share code, notes, and snippets.

@olzhas
Last active September 9, 2019 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olzhas/92915c752680e1e1a109a55413bb3479 to your computer and use it in GitHub Desktop.
Save olzhas/92915c752680e1e1a109a55413bb3479 to your computer and use it in GitHub Desktop.
Change swapfile size in Ubuntu 18.04
  1. Turn off all swap processes
sudo swapoff -a
  1. Resize the swap
sudo dd if=/dev/zero of=/swapfile bs=1G count=8
  • if = input file
  • of = output file
  • bs = block size
  • count = multiplier of blocks
  1. Make the file usable as swap
sudo mkswap /swapfile
  1. Activate the swap file
sudo swapon /swapfile
  1. Check the amount of swap available
grep SwapTotal /proc/meminfo
@olzhas
Copy link
Author

olzhas commented Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment