1

I want to do what follows:

  1. set (via systemctl) a trim timer which would trim more than once a week but less than daily. Say every three days.

  2. I want to be sure that if the system is turned off or sleeping what the scheduled trim should be executed, it will be executed at the next awakening/boot.

How can I do that?

  • 2
    Possible duplicate of Is TRIM enabled on my Ubuntu 18.04 installation? – N0rbert Oct 27 '18 at 8:04
  • Thanks. However it doesn't seem to answer my question: "I want to be sure that if the system is turned off or sleeping what the scheduled trim should be executed, it will be executed at the next awakening/boot". – MadHatter Nov 2 '18 at 15:32
1

Not a perfect solution, but as a stop-gap, you can manually trim on-demand via a command like sudo /sbin/fstrim -av See below before running this; you want to make sure you get the right command!

systemctl cat fstrim.service will show you the fstrim service file.

Look at the bottom and see what's being executed. You'll see this after the line ExecStart=. It will probably, for Ubuntu 18.04, be calling /sbin/fstrim -av.

With this in mind, run sudo /sbin/fstrim -av and you'll see something like

/boot: 0 B (0 bytes) trimmed
/: 6 GiB (6384705536 bytes) trimmed

Boom, trimmed!

And, yes, it doesn't ask the question you're really after, which is the same question I have after seeing this question. I'll look into this myself on my laptop and post back here--it'll help us both!

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.