My /etc/cron.daily/fstrim looks like this:

# call fstrim-all to trim all mounted file systems which support it
set -e

# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g.  https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
exec fstrim-all --no-model-check

And yet trimming does not occur daily. I tested this by trimming, then writing ~30GB and deleting it, waiting for 24+ hours (~48 hrs in fact and barely used the computer) and trimming again with fstrim -v /. 45GB was trimmed on the 64GB disk.

What is wrong? Manual trimming seems to work, only the cronjob doesn't. The drive is Samsung 830.

  • check that the cron job is being run. /etc/cron.daily/fstrim must have no write access to other than the owner root, and must be executable (unlike in /etc/cron.d/). Look for messages in the logfiles. – meuh Dec 27 '15 at 17:09

fstrim might trim all free space regardless whether it was already trimmed. This is the decision of the filesystem. So unless you are very sure about your filesystem's characteristics, as long as the value reported by fstrim does not exceed free space, is not an indication of an error.

As for testing whether something was trimmed, you could try: https://unix.stackexchange.com/a/85880/30851

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.