Best swap set up?

Associate
Joined
13 Mar 2003
Posts
1,472
Location
location,location
Back in the ancient times when I started using linux it was usual to format a separate swap partition. I have just installed endeavourOS on a new nvme drive and noticed that the installer defaults to no swap. A bit reading and it seems that a separate swap partition is not recommended on solid state drives as it will concentrate wear on a small area of the drive. Alternatives seemed to be a swap file or xram or xswap ram drives. I couldn't find a clear answer on what would be the best solution.

What are you using? My system is just a general purpose desktop install.
 
I'd probably go zram if I was you. Ignore the whole swap partition wears your SSD it's a non-issue for the most part.
 
It might help if I get the name right. I see that ubuntu now defaults to a swap file. I will have to do some more reading and decide between the options.
 
I have never really put any thought into it if I am honest.

All of my Linux setups ( 3 PCs and 2 Laptops ) all have the exact same way of being setup.

SSD that is for root and an 8GB Swap. Of course more recently, with a FAT32 for /EFI boot
HD for /home

My big Laptop and my Desktop PCs also have another HD that I have mounted at /home/data

This is for extra junk, for example my STEAM folder, and junk or whatever

One of the PCs I have been experimenting with LVMs

But they ALL have SWAP PArtitions on them of 8GB and that is always setup at the end of the disk, and yes, they are all on SSD's

Other silly tests I have done

When I got a 16GB mSata drive and I used that purely as its own SWAP on /sdd but I didnt really see any actual benefit.
I have also tried SSD for only root and a HD for /home and Swap.
I honestly didnt see any slow down in general use either.

I then dropped the RAM from 32GB down to just 8GB and then it was clear that it was doing a fair bit of swapping, especially when I had a number of apps open and I was going between them, but under basic use... not really that much
 
With an NVMe drive and a system not constrained by little RAM, swap often isn't necessary these days. Where it is, a swap file can be used in place of a partition, but as above using zram is a better alternative. You can allocate, say, max 50% RAM to zram/swap and just leave the system to manage things. It's pretty seamless, and some distros like Fedora do it by default nowadays.
 
Back in the ancient times when I started using linux it was usual to format a separate swap partition.

Back when I studied CS, the advice was to put the swap space on the most used partition of the least-used drive. But that was nearly 40 years ago.

A bit reading and it seems that a separate swap partition is not recommended on solid state drives as it will concentrate wear on a small area of the drive.

Modern SSDs have wear-levelling firmware so this is not applicable.
 
Back
Top Bottom