Best solution for swap with ssd disk

Hi Archlabers!

I recently read about swap and ssd.
Do I reduce life-span a lot by using ssd swapfile?
If I have at least 8G ram and reduce swappiness to 10?

How do you guys (including girls) do with swap or swapfile?

womp

You read some obsolete advice.

Read this instead: https://techreport.com/review/27909/the-ssd-endurance-experiment-theyre-all-dead/

It is no longer necessary to limit writes to SSDs, they will probably outlast spinning rust drives.

1 Like

Thanks for answer.
So what does this mean when it comes to:

swap
noatime - discard
fstrim

?

womp

Don’t bother with noatime, the saving in writes is irrelevant and the performance difference between that and the default relatime option is miniscule. And it breaks mutt.

The discard option will slow down the drive (slightly) so you should probably prefer the fstrim.timer unit supplied by the util-linux package:

systemctl enable fstrim.timer

^ That will trim the drive once a week.

But the drive will be overprovisioned and the firmware will almost certainly carry out a similar operation automatically so you probably don’t need it.

1 Like

I thank you for your wisdom!

I read in Linux Mint that they recommend an “override” to fstrim daily. Do they have a “point” there?

womp

Do you have a link for that? I’ve been using the timer on my Debian systems and it’s been fine AFAICT.

Here comes the link:

Yeah, the author of that article seems fairly ignorant — they don’t appear to know that fstrim.timer is already supplied by the util-linux package and they seem to think that an untrimmed drive will reduce the storage space, which simply isn’t true at all. A weekly trim is quite sufficient, there’s no need to do it every day IMO.

2 Likes

Good to hear!!

womp

I dont remember when I last checked mine:

systemctl status fstrim.timer
● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Sat 2020-06-20 17:51:31 PDT; 15min ago
    Trigger: Mon 2020-06-22 00:00:00 PDT; 1 day 5h left
   Triggers: ● fstrim.service
       Docs: man:fstrim

Jun 20 17:51:31 abc-TC-885 systemd[1]: Started Discard unused blocks once a week.
1 Like