No SSD TRIM script in Ubuntu 20.04 LTS

I figured out that there is no fstrim script in /etc/cron.weekly. I've read that TRIM is automatically enabled for SAMSUNG SSD. I'm using Ubuntu 20.04 LTS and there is no fstrim script in all cron folders. In /etc/fstab discard isn't set either - but discard isn't recommended anyway.

I created now the fstrim script in /etc/cron.weekly. I hope that interferes with no other script or missed I something?


fstrim is managed by systemctl, not cron, and is defined by a systemd service unit called fstrim.service and a timer unit called fstrim.timer.

$ locate fstrim.service
...
/usr/lib/systemd/system/fstrim.service

Please use

$ systemctl status fstrim.timer

to check for the status of fstrim. It will show something like ...

● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: >
     Active: active (waiting) since Wed 2021-01-27 02:23:22 CET; 1 day 21h ago
    Trigger: Mon 2021-02-01 01:02:07 CET; 3 days left
   Triggers: ● fstrim.service
       Docs: man:fstrim

jan 27 02:23:22 discworld systemd[1]: Started Discard unused blocks once a week.

If that is not the same for you... the ssd might not be compatible.