Does it make sense to create swap partitions for new installations nowadways?

Yes you need swap, if you just use it for suspend and minor swap actions a swap file somewhere on your disk might be fine, And i been using swap file from almost a year never ever had problem with it, just don't like partitioning the disk.

Just copy paste the following line in terminal and it will create 2 GB of swap. First become root:

sudo su

Then copy and paste pate the following (as always, make sure you understand what you are pasting on your terminal):

mkdir /swap && \
cd /swap && \
fallocate -l 2g 2GB.swap && \
mkswap 2GB.swap && \
swapon 2GB.swap && \
echo "# # # Swap File # # #" >> /etc/fstab && \
echo "/swap/2GB.swap none swap sw 0 0" >> /etc/fstab && \
mount -a

Swap (partition vs file) for performance

Down Side

You cannot hibernate to swap file, as mentioned by @Takkat, I have check and i have 1st time in my life try to hibernate but its not working, so if you want to hibernate yo need swap partition, otherwise if swap file is good to go.

Hibernate vs. Suspend


If you want to be able to hibernate, then yes, it is necessary to have a swap partition at least as large as your total RAM.

Apart from that, if you have 16GB of RAM then in principle probably not - I've seen people saying that 1GB is plenty to run without swap, though I imagine it would boil down to a matter of opinion for many people. In my case, I'm running a laptop with 8GB RAM and have a swap the same size for hibernation purposes (with the side-effect that it provides a buffer if my work becomes particularly memory-intensive, as it can do sometimes)


Is this a theoretical question or a practical one?

In practice, there's almost no reason to avoid a swap partition because disk space is cheap and plentiful (especially on shiny new laptops).

On paper, it might seem that 16GB of memory will never be used up. Consider these circumstances:

  • certain programs (e.g. video editors, LibreOffice) use an exorbitant amount of pages when starting up for initialization, then never used again
  • unforeseen circumstances: a program going crazy, a fork bomb

Now consider them happening at the same time. A swap partition will serve as a buffer when unpredictable events line up, buying you some time before the system crashes to save work, etc.

Specifically because have a laptop, there will come a time when hibernation saves your skin. Perhaps you will leave your computer for a coffee break, but something comes up and you, instead, return an hour later. If your battery picks that moment to die, hibernation will protect your unsaved work.

Tags:

Swap

Laptop