Ubuntu: Change Swapfile Size

Taken from Ploi:

  1. Turn off all running swap processes: swapoff -a
  2. Resize swap fallocate -l 1G /swapfile (change 1G to the gigabyte size you want it to be)
  3. CHMOD swap: chmod 600 /swapfile
  4. Make file usable as swap mkswap /swapfile
  5. Active the swap file swapon /swapfile

To verify your swap size run the following command and you will see the swap size: free -m

Disclaimer:

Not all articles here are meant to be correct. My notes might be wrong or may no longer be relevant. If you want to try things here, please proceed with caution.


Posted

in

by

Tags: