fstrim timer on ssd

also man (8) fstrim

fstrim is used on a mounted filesystem to discard (or "trim") blocks
which are not in use by the filesystem

this is useful for solid-state drives (SSDs)
and thinly-provisioned storage

create the files:
# cat > /etc/systemd/system/fstrim.service << "EOF"
[Unit]
Description=Discard unused blocks

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -av
EOF


# cat > /etc/systemd/system/fstrim.timer << "EOF"
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target
EOF

enable fstrim.timer
# systemctl enable fstrim.timer

check the service:
# systemctl list-timers
and
# journalctl -u fstrim.timer

also:
reset ssd cells to factory condition