Myron Posted March 27, 2022 Share Posted March 27, 2022 Is every 6 hours a good interval to fstrim an SD card? Is it safe for the SD card to be TRIMed often? I know that SD card trimming is not like TRIM on an SSD, but the operation performed on a SD card that supports CMD38 performs a similar function, to tell the SD card which pages do not contain valid data. 0 Quote Link to comment Share on other sites More sharing options...
TRS-80 Posted March 31, 2022 Share Posted March 31, 2022 Sounds way too frequent to me. Unless you are maybe constantly writing to it or something. In which case you should use something more robust like the sort of (industrial, expensive) hardware they recommend for ZFS cache. In normal usage I would think like twice a year (or quarterly, monthly?) maybe, I dunno. Why do you think you need to do it so often? On 3/27/2022 at 11:01 AM, Myron said: I know that SD card trimming is not like TRIM on an SSD Yes and a lot of info out there on the Internet about trimming SSD are out of date. In most cases all that is done automatically now. As you point out though, I am not sure how this works on flash devices. 1 Quote Link to comment Share on other sites More sharing options...
Myron Posted March 31, 2022 Author Share Posted March 31, 2022 I changed it to 24 hour intervals, out of curiosity and the result was ... /: 693.2 MiB (726855680 bytes) trimmed on /dev/mmcblk0p1 I think this is configured to do this this once per week via systemd, but I'm not sure if this is working hence creating a cron task. Looks like it is. I will wait for 4 days and look as /var/log/syslog. root@loki:/usr/lib/systemd/system# systemctl status fstrim.timer ● fstrim.timer - Discard unused blocks once a week Loaded: loaded (/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled) Active: active (waiting) since Mon 2022-03-21 14:20:12 GMT; 1 weeks 3 days ago Trigger: Mon 2022-04-04 00:00:00 BST; 3 days left Triggers: ● fstrim.service Docs: man:fstrim Thanks for your technical wisdom. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Solution TRS-80 Posted March 31, 2022 Solution Share Posted March 31, 2022 Previous estimate I totally pulled from my rear end, because I have no idea. But sounds like maybe a little more often than I was thinking. Probably whatever system default is doing is likely fine, unless you really know what you are doing and/or have some reason for changing it? 1 Quote Link to comment Share on other sites More sharing options...
Myron Posted March 31, 2022 Author Share Posted March 31, 2022 I'll stick with the system default. I was not sure if fstrim was being invoked on a schedule at the time. 0 Quote Link to comment Share on other sites More sharing options...
Myron Posted April 4, 2022 Author Share Posted April 4, 2022 @TRS-80 Maybe it's a good thing that I got a 32Gb card in the BananaPi Pro. After a week the systemd task did fire and the result was.... Apr 4 00:00:54 loki fstrim[7422]: /: 20.2 GiB (21645828096 bytes) trimmed on /dev/mmcblk0p1 I may have fstrimmed the card a day or so into the week so this time I have to promise myself to leave it alone and check again in 6 days. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.