How would fstrim.timer work when both SDD & HDD exist?

Will HDD also be trimmed while it is not necessary?

TRIM doesnt work on the HDD … enabling the timer will just mean your SSD runs fstrim from time to time.

2 Likes

According to the post below, HDD is also trimmed.
https://askubuntu.com/questions/1297642/is-it-normal-to-have-hdd-fstrimed

Fstrim only works with SSDs.

2 Likes

If you open

man fstrim

and read the documentation you will find that fstrim only tries to discard for devices that supports it.

E.g.

[...]
       -a, --all
           Trim all mounted filesystems on devices that support the
           discard operation.
[...]

Which essentially means that devices which do not support it are skipped.

For your reference to an almost 3 year old topic - I’d say - either fstrim got smarter or the poster had other issues.

Please heed the warning in the manual

[...]
       Running fstrim frequently, or even using mount -o discard,
       might negatively affect the lifetime of poor-quality SSD
       devices. For most desktop and server systems a sufficient
       trimming frequency is once a week. Note that not all devices
       support a queued trim, so each trim command incurs a
       performance penalty on whatever else might be trying to use
       the disk at the time.

[...]

Another thing to note is

If you do not enable the fstrim.timer - then after some time - depending on your usage - e.g. a lot of ISO files coming and going and the size of your SSD - you will run into mysterious slow-down of your disk - this is the consequence of not running trim - because trim free’s up memory cell marked as in use even the content has been deleted.

This is normal and part of the design - a design that makes it very hard to scrub a SSD device completely for reuse. It this is a topic that interest you the following links are interesting and very educating

This research paper https://www.usenix.org/events/fast11/tech/full_papers/Wei.pdf is an interesting read.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.