Enable fstrim service for SSD/NVMe drives

If you use SSD (solid-state drives) or NVMe, fstrim service is useful for you. fstrim is used on a mounted file system to discard (trim) blocks that are not in use by the file system.

systemctl enable fstrim.timer
systemctl start fstrim.timer

Solid State Drive - ArchWiki

5 Likes

Funny story… when my old PC broke down, I bought a new one and after installing Mabox I forgot to turn on fstrim. That was over 600 days ago and everything was working fine for a long time. Recently, however, I have noticed serious slowdowns when performing tasks that require frequent writing and reading from the disk. Problems occurred when using VirtualBox, sometimes Firefox slowed down a lot, but the worst problems occurred when building test Mabox ISO images. For some time I thought the disk was dying - until I finally remembered fstrim.

After turning on fstrim, building the ISO takes 5 minutes, not 25-30 like recently :wink:

The difference in performance can be huge and it is worth enabling fstrim before problems arise.

3 Likes

I will have to check this out.

Finally, I payed attention. Thanks for the tip!

This applies only to ssd’s or is it also valid for mechanical HD’s?

SSDs only.

HDD drives stores the info in magnetic, rotating plates. SSDs, on the other hand, is a special type of memory. As you write data the memory cells slowly degrade. That’s why the SSD’s firmware has several ways to ensure that every cell is used evenly.

2 Likes

@M0nst3r . Thank you very much