0

I have an existing virtual storage but it is not enough and I cannot find a solution to this problem. I want to increase my existing virtual memory size. Any help is appreciated.

Stryker
  • 13

1 Answers1

2

Increase swapfile size to match RAM size

  • Check the swap that is in use:

    sudo swapon -s
    
  • If swap partition(s) are found:

    sudo swapoff -a
    sudo nano -Bw /etc/fstab
    
  • Add # before the UUID of the swap partition(s):

    # UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX   none   swap    sw     0       0
    
  • Add a line for the swapfile, if one does not exist:

    swapfile   none    swap     sw      0       0
    
  • Create the swapfile:

    sudo fallocate -l XG /swapfile*
    

    where X is swapfile's size in GB:

    sudo mkswap /swapfile
    sudo chmod 0600 /swapfile
    sudo swapon /swapfile
    
  • Reboot:

    sudo reboot
    
C.S.Cameron
  • 19,519
  • use instructions here to make the swap file permanent: https://www.javacodemonk.com/permanent-swap-space-in-centos-and-ubuntu-f36bb1bf

    Missing commands:

    $ sudo nano /etc/fstab

    add this line to the fstab file and save: /swapfile swap swap defaults 0 0

    – FlyingZebra1 Jun 01 '23 at 02:55