systemctl status fstrim.timer● fstrim.timer - Discard unused blocks once a week
Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Sat 2020-02-15 04:58:46 MST; 1 day 11h ago
Trigger: Mon 2020-02-17 00:00:00 MST; 7h left
Docs: man:fstrim
systemctl status mlocate.timer
● mlocate.timer - Daily locate database update
Loaded: loaded (/usr/lib/systemd/system/mlocate.timer; enabled; vendor preset: disabled)
Active: active (waiting) since Sat 2020-02-15 06:22:11 MST; 1 day 10h ago
Trigger: Mon 2020-02-17 00:00:00 MST; 7h left
Docs: man:updatedb
They’re both triggered at the same time. I know they are doing different things, but can they get in each other’s way? (I just discovered that updatedb.timer is no more, and was replaced by mlocate.timer, which I enabled just yesterday. I’ve not got the foggiest why I didn’t notice the db wasn’t being updated automatically. I do run updatedb quite often, though.)
The timers start the service units. You may check their logs:
erlangen:~ # journalctl -b -u fstrim.service
-- Logs begin at Fri 2020-02-14 07:59:41 CET, end at Mon 2020-02-17 07:19:53 CET. --
Feb 17 05:34:42 erlangen systemd[1]: Starting Discard unused blocks on filesystems from /etc/fstab...
Feb 17 05:38:03 erlangen fstrim[13748]: /boot/efi: 100,1 MiB (104955904 Bytes) auf /dev/sdb1 getrimmt
Feb 17 05:38:03 erlangen fstrim[13748]: /home: 155,9 GiB (167347097600 Bytes) auf /dev/nvme0n1p3 getrimmt
Feb 17 05:38:03 erlangen fstrim[13748]: /: 46,4 GiB (49770946560 Bytes) auf /dev/sdb5 getrimmt
Feb 17 05:38:03 erlangen systemd[1]: fstrim.service: Succeeded.
Feb 17 05:38:03 erlangen systemd[1]: Started Discard unused blocks on filesystems from /etc/fstab.
erlangen:~ # journalctl -b -u mlocate.service
-- Logs begin at Fri 2020-02-14 07:59:41 CET, end at Mon 2020-02-17 07:19:53 CET. --
Feb 17 05:34:42 erlangen systemd[1]: Starting Update locate database...
Feb 17 05:34:42 erlangen su[13762]: (to nobody) root on none
Feb 17 05:34:42 erlangen su[13762]: pam_unix(su:session): session opened for user nobody(uid=65534) by (uid=0)
Feb 17 05:36:21 erlangen systemd[1]: mlocate.service: Succeeded.
Feb 17 05:36:21 erlangen systemd[1]: Started Update locate database.
erlangen:~ #
Looking at what “mlocate” does, you may have to modify the systemd timer service such that it waits an hour or two before it triggers the “mlocate” service.
Take a look at the “systemd.timer” man (5) page – there’s a “RandomizedDelaySec=” parameter which modifies the “AccuracySec=” value within the [Timer] section of the systemd file.
Please be aware that, after every update/patch of the “mlocate” package, you’ll have to check that the systemd timer service file hasn’t been reset to the default values …
Hi
That’s why we have /etc Roll back your changes and ‘copy’ the file to /etc/systemd/system, make your modifications here and it will override anything installed by the system… don’t forget to use systemctl daemon-reload as well.
Warning!
Avoiding Overwritten Customization: Always do systemd customization in /etc/systemd/, never in /usr/lib/systemd/. Otherwise your changes will be overwritten by the next update of systemd."