Is there a way to tell if fstrim is being executed as scheduled?

Hello,
This question is in relation to SSD trim. I hope I have placed the question in the correct area. This is my first post, so please forgive me if I have made any errors.
I have searched this question and haven't found a clear answer.
I have activated the fstrim service, and the fstrim.timer file in /usr/lib/systemd/sys says that it is set to trim weekly.
My question is: Is there any way to tell if the trim is being executed as scheduled, through a log or some other method?
Thank you for your time, and I would also like to say what a great forum this is. I have been on here for several months now, and this is the first time that I have not been able to find an answer to my questions.

2 Likes

The following will inform you when the service has been activated

journalctl -u fstrim
4 Likes

Thank you Nergal. I appreciate your help.

Would you mind telling us (me) how you made it work? I am alslo looking for this sine I use an SSD as well.
Thanks.

1 Like
1 Like

on my system it is this folder:

/usr/lib/systemd/system/

your post inspired me to add an easy way to edit systemd timers to pacli-simple's "configure system" option with the latest commit:


thanks!

1 Like

another way to see an overview of all running systemd timers:

systemctl list-timers

source: https://wiki.archlinux.org/index.php/Systemd/Timers#Management

4 Likes

Hello DeMus,
It is scheduled to work in six days. When the trim is executed at that time, I will know for sure that it has worked. As to the answer to your question: How you made it work? excalibur is correct with the steps that I followed to enable fstrim.timer service. I also have these steps included in my notes from searching the method for this service.
Activate fstrim.service: sudo systemctl enable fstrim.timer
To see the file with the setting for fstrim.timer: cat /usr/lib/systemd/system/fstrim.timer
To see the journal of fstrim.timer execution: journal-ctl -u fstrim
To start the timer: sudo systemctl start fstrim.timer.

2 Likes

Thanks for sharing this excalibur:
When I listed the timers, including the --all option, it showed the fstrim. timer wasn't active.

What I did wrong, was to not start the timer.
The solution was: sudo systemctl start fstrim.timer
fstrim.timer is now listed in the timer list and is counting down to its execution date.
Thanks for the help.

Thank you all for explaining this. It also works in my computer now.
Great help.

1 Like

Forum kindly sponsored by