Change swap size in Ubuntu

DocumentationServer > Change swap size in Ubuntu

In a nutshell swap is a piece of storage (used from your harddisk) which can be used as additional RAM. If you want to change the size of your swap file (which is 1GB by default on Ploi) just follow the following steps.

  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

Thats it! Some commands may take some time to be executed, just wait patiently for the commands to finish.

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

01 June 2019
111 views