Swap on SSD

Frank Leonhardt frank2 at fjl.co.uk
Mon Feb 5 16:13:29 UTC 2018

On 2018-02-04 11:19, @lbutlr wrote:
> I have a machine that has dual SSDs in it and no spinning disks.
> FreeBSD has a 4GB (or so) swap partition that it created on the
> installation of FreeBSD 11.1.
> Isn't this going to cause problems for the SSD to have swap constantly
> working the drive?

Assuming you have enough RAM, I'd turn it off. "swapoff -a" if you can't 
wait and edit fstab if don't mind a reboot.

You could use gpart to return it to normal use.

But there's more to it than that. And all SSDs are definitely NOT 
created equal. Some cost 10x as much as others and are designed to be 
pounded. Others are cheap and expect to be treated gently. If you're 
using an enterprise SSD it probably won't matter, but you'd probably 
know it if you were.

FreeBSD doesn't actually swap these days; uses demand paging. This means 
that blocks of RAM that are hardly ever used can get copied to disk. 
This may include some stuff that's only accessed a few times a year, but 
would otherwise be occupying precious RAM that would be much more useful 
as a disk cache. That said, FreeBSD tends not to page out except as a 
last resort - probably a mistake but I can't prove it.

It's perfectly feasible to run with no swap. I sometimes think the 
gradual slow-down due to lack of caching/buffer space is preferable to a 
thousand page-faults/second.

But what works for you depends on the workload and available RAM.

More information about the freebsd-questions mailing list