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.
Asked
Active
Viewed 1,490 times
0
-
Where is the virtual memory? on the hard drive or in a file? – Emoji Apr 16 '21 at 04:19
-
How large is the current size? – David Apr 16 '21 at 05:29
-
Idk current size is 2gb. And my ram is 4gb. Ubuntu runs out of ram quick. – Stryker Apr 16 '21 at 06:35
1 Answers
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 theUUID
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
isswapfile
'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