Increasing system swap space

I prefer to run VMware Player recommends 8 GB of system swap space and I have currently 980 MB system swap space. How do I increase the current system swap space?

Increasing swap size or swappines is quite easy, so have at it::wink:
https://arcolinux.com/how-to-increase-the-size-of-your-swapfile/

I hope no one minds if I ask some questions in this thread. I am known for my curiosity and my enthusiasm :nerd_face: :nerd_face:.
So here goes the questions:
What is a swap partition?
What does it do?
Do I need it?
I googled these questions. Not satisfied with those answers....

Swap area is virtual memory. Windows used to have swap file in the system directory. If you don't create a swap area at point of install and you choose auto installation Zorin creates a file. I prefer to create a swap area which should always be double the amount of Physical RAM you have present so my swap area on my daily distro is 32 GB.

1 Like

Indeed Windows uses a swap file within the system directory and since I have an HP Z620 with one Xeon E5 2650 V1 processor and 64 GB of internal memory having ZorinOS 16 Pro dual booted next to a Windows 10 install on a seperate 256 GB SSD drive as is my ZorinOS install on a 512 GB SSD drive I should up it to 128 GB for smooth running of my VMware hypervisor ?

I know that double the physical memory advice but it is impossible for me. I have 64 GB RAM and if I double it, it will take 50% of my 240GB SSD :stuck_out_tongue:

2 Likes

But how do they benefit?
I have 4GB RAM, should I create a swap partition of 8GB?

It can help provide the effect of having more RAM by allocating a small portion of your hard drive to act as RAM.
This works best if you set the swappiness value higher.
If you set a swap file of 8 Gigs RAM, then it would behave as if you have 12 gigs of ram instead of 4.
If you are not noticing sluggish responses when you run out of RAM, then you may not need to bother.
I usually recommend Swap be set to half your physical RAM to no more than double your physical RAM.

1 Like

Thanks, I read in one of articles in google that swap partition should be created after checking the rpm of hard drive. I cannot find the article anymore. I have 5400 RPM hard drive. Should I create a swap partition?

That depends more on if you have the swap file on a different drive (Or a swap partition on a different drive) than the one that you are using. You can end up with swapfile-read lag if they have different speeds.
Yes, you can create a swap file if you need one.

2 Likes

That's why I much prefer spindle disks, at least you can recover data from a spindle disk! :wink:

1 Like

Then, why does in this article lowering the value of swappiness is one of their suggestion to speed up computer? Its the same for Linux Mint forum.

2 Likes

Because it is complicated.
A lower value will use Swap Space less. A Higher Value will make more use of Swap Space.
Utilizing Swap Space takes resources of its own to do, so increasing that value under a Light RAM load can actually have the opposite of intended effect, slowing your computer. However, increasing swappiness under a heavy RAM load will have the opposite effect of that... Speeding up your computer.
...And the same is true in reverse.
So, in short - it really depends on how you use your computer and what software is placing the highest demands. And speed is not necessarily the goal. Avoiding running out of memory is. Reading from a spinning hard drive can be slower than reading from the solid state RAM, too. The more swappiness, the more you may be reading from Spinning hard drive, unless you have SSD.

Swappiness is considered a Fine Tune thing. Default is set to 60.
It can range from 0 to 100.
Tuning your swap value should be done in small increments and tested thoroughly before changing the value to optimize performance.
But sadly, it is not so simple as Increase for faster speed or decrease for slower speed.

Setting the swappiness value higher means that you will allocate More Swap Space to RAM, therefor providing you the most use of RAM. But this is not necessarily the same thing as speed (Rather, utilizing available memory to avoid Freezes and Crashes) and the default 60 is usually sufficient for most users. Most users are not doing like I Do and running Inkscape, Blender, GIMP and a bunch of other stuff all at the same time. While blasting loud music.

4 Likes

Well explained....better than any other article in the internet.
:clap: :clap:

1 Like

I ask since I have a habit of opening lots of tab then going on opening softwares like krita or inkscape and Lunacy. So, for those have 4gb ram, if I want to go all out, then I can make use of this for temporary solution? then turn back to what it my default if I went back to my normal usage?

2 Likes

Maybe?
The only way for you to know is - Testing. Based on your usage.
Do you experience heavy lag now? Do you experience freezing and / or crashes if you overload RAM (I monitor my RAM usage with a conky)?
If you are not experiencing the above, and your computer is just a little slow, then I wouldn't worry about Swap.
When your RAM fills, your system will clear out Cache from RAM to free up some space.

If you set a higher swappiness and you are using a Spinning Disk hard drive, it may take longer to use swap, as the system will not bother to clear out Cache from RAM and will instead use Swap Space.
This can make things go slower.
If you have an SSD card, higher swappiness would help you, if you are running applications that have less Cache and More Active Memory.

And bear in mind, CPU speed will be a variable in this, too.

Default Swappiness is probably fine for you. One option is to address habits, rather than swap. Try to tidy up while you work (Much like I do when cooking or working in the shop - Clean As You Go). Close unneeded tabs. Clear your cache.

Does swappiness level matter if you have no swap partition?

Yes. There are two basic forms of Swap:

  • Swap file
  • Swap partition

A swap file places swap space on the Primary partition in a block. This block is delegated only to swap (Unlike Windows NTFS which puts everything anywhere in the first available space).
A swap partition is a separate partition from the Primary partition, allowing the swap partition to be utilized and available even if the primary partition is in Hibernate or Suspend.

Swappiness is a factor if you have either a swap file or a partition.

2 Likes