Swap file questions

I have 8 Gb of ram.

I have no swap file.

Is there any benefit to having a swap file?

Is there a method of checking if it is benefiting the system?

I have a button on my keyboard that looks like a quarter moon.

When I press it, the computer goes in idle.

Is that a hibernation button ?

Swap is used when you don’t have enough RAM: the system swaps data between the RAM and space on a drive. It basically uses part of a hard disk as virtual RAM.

So, having swap has the benefits of being able to to things if all your 8 GB RAM is used. It was very useful when computers had low amounts of RAM but not so much today when they have an average of 8 to 16 GB. It can still be useful for applications that need a lot of RAM (e.g. some games) but overall, it’s not really a requirement to have swap these days.

On Linux, there are two ways to handle swap:

  • by having a dedicated partition with a specific filesystem
  • by having a file on a normal partition

Traditionally, Linux distros created a swap partition at installation. Ubuntu uses a swap file since a few versions (not all the variants, though, I’m not sure about Ubuntu MATE).
A partition has the advantage of being separated from the system, so you don’t have to worry that your disk becomes full and you don’t have space for the swap. It’s also probably faster to use to have a dedicated partition with the specific filesystem than a file on a regular partition (that’s personal assumption). Also, with a swap partition, the system can hibernate as long as the partition is at least the same size as the RAM. A partition has the disadvantage that its size is fixed and not easy to resize, which can be problematic if you add more RAM to your PC and the swap is then not big enough to hibernate.
A swap file has the advantage of being more easy to manage and being of any size (as long as you have enough space on the partition it lies on). It has the disadvantage of not allowing hibernation at all (AFAIK).

You say you have no swap file but are you sure you don’t have a swap partition made during installation of the OS?

I’m not sure what your button does: when you press it, does the computer appear to shut down and you get back to its exact previous state when you power if on? does it just go idel like a screensaver (i.e. it doesn’t shut down and you move the mouse to get back to the system)?

Thanks.

Moving mouse does not restore system, only hitting the button again does.

When you hit the power button, you get your system back immediately, right, it doesn’t have to boot? If that’s the case, that’s hibernation and it implies that you have a swap partition as I don’t think it’s possible without one.

I was not talking about power button, but the button on keyboard in upper left corner that has a half moon on it.

The fans in the computer stop running and power light goes out.

I think it does put computer into hibernation.