Swap or not?

I have 16 GB of RAM and most of the time I use only half of that. I want to install Endeavor with Plasma.
Should I create a swap partition when installing? Or create a swap file later? Or neither?
Please point me to some instructions on how to do whatever it is recommended that I do.

If it is a desktop computer, don’t bother with a swap partition. You can easily create a swap file later if you really need it (with 16 GB of RAM, unlikely). A swap partition is a pain if you ever decide to resize or remove it. Every time I made a swap partition I regretted it. A swap file works just as well and it’s super easy to manage it.

If it is a laptop and you want it to hibernate, then you’ll need either a swap partition or a swap file. A swap file is more flexible, but it’s somewhat of a pain to setup your system to hibernate on it, so if you’re lazy and have plenty of storage, just make a swap partition about the same size as your total RAM or slightly bigger (which is also probably an overkill, but you want to be sure your computer always wakes up from hibernation successfully).

If you are using btrfs as your file system and for some reason you must use an older kernel (version < 5), do some reading about swap files, there may be issues. I have no experience with that. In that case it might be simpler to use a swap partition or just stick to ext4 (or just not use swap at all).

Welcome to the forum. :wave:


Disk space is cheap nowadays.
For me swap should always be 2x my RAM.
On my current setup I have 16GB RAM and a 32GB swap partition.


Seconding the swap file. I have 16GB of RAM on my laptop and went with a small swap file, juuuuust in case.


Welcome to the community :beers:

In this case perhaps an smal zram also could do the job. Might be even better.

1 Like

I have swapfile on btrfs encrypted lvm. Thanks to archwiki setup was done in a couple of min.
So: yes, some work needs to be done, but it is easy and I recommend to do it.


Welcome to the swap-community!


You naughty boy!

Werft den pösen Puben zu Poden!

رمي العانة الشريرة في القرون!


Completely agree. I just added another 8 gigs of ram to have 16 like I prefer and even with 8 gigs I rarely went over 2.5 used. Setup the system with no swap partition or file and I’m not noticing any performance decrease because of that choice.


I personally always swap. I only have laptops though. I use hibernate a lot. Swap = RAM. If it’s an HDD, it’s a partition, if it’s an SSD, it’s a file.

If it’s a desktop, it’s completely your call. Just remember, no swap, no hibernate.


Is there a reason for this? I’ve heard some stuff about a swap partition being harmful for SSDs (as opposed to a file), but is that something to be concerned about for, say, my laptop with 8GB RAM?

Yes, technically any write operation = bad for SSD = each write reduce it’s lifespan.

Personally i would not use swap for 8 Gb RAM, unless you need to hibernate or do something very heavy routinely…

With 4 Gb i would think about it maybe :upside_down_face:

1 Like

That’s pretty much how I think about swap. With 16 GB RAM, it’s unlikely you’ll ever need it in normal usage. And if you do happen to need it, making a swapfile is literally 10 seconds of work (and waiting maybe 5 minutes for dd to do its magic and copy zeroes to it). Or, if you don’t need swap, but are really paranoid about running out of memory, you can set up systemd swap.

If you want to hibernate, you need swap, of course. A swap partition is easier to setup for hibernation, but a swap file will always be more flexible.

I’ve got 5 GB of RAM on my laptop, and it needs swap. I made a 7 GiB swapfile for it, just so it can hibernate without any worries. It’s a bit wasteful, but I’ve got a 2 TiB HDD in it, so I don’t care.

But I do notice it writing to the swapfile from time to time, even in normal usage (when opening more than a couple of tabs in Firefox, for example). Not very often, and it rarely uses over 500 MiB of swap, but it does use it.

If it bothers you, try to override default (too aggressive in my opinion) settings:

  1. Reduce swappiness

  2. Reboot

1 Like

It does not bother me, as it is really rare. But I did set swappiness to 10 on it a long time ago (when I was testing those performance tweaks by librewish). Didn’t notice any difference, to be honest :slight_smile:

1 Like

(hmm, my system’s currently set up to hibernate soon after closing the lid…)

In that case, is a swap partition any more detrimental than a swap file? I’d be inclined to try replacing my swap partition with a file if it’ll extend the lifetime of my SSD.

1 Like