Enabling TRIM on the Raspberry Pi

Previously I discussed the importance of TRIM in a separate thread, located here:

After reading that, the question becomes “How do I do it so that it really works and survives a reboot?”

Rather than re-invent the wheel, I’ll refer you to an article that (IMHO) is the canonical authority on setting up TRIM.

https://www.jeffgeerling.com/blog/2020/enabling-trim-on-external-ssd-on-raspberry-pi

His advice has the desirable attributes of being explicit, complete, and (relatively) simple to implement.  Especially - as when using the Raspberry Pi operating systems - many of the constants and values needed are the same as the ones pre-calculated by him in his article - at least when running Buster.  (Though you should calculate them yourself once just to see if they match.)

In fact, much of his code is “cut and paste”.

This is the guide I use and it appears to work.

What say ye?

1 Like

P.S.

While you’re messing with TRIM, you might want to check/update the filesystem consistency checking parameters using tune2fs - then you have “the full monty” of protections and efficiency updates to ensure your system doesn’t suddenly go all pear shaped.

Viz.:

1 Like