This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Slow SD card fixed with TRIM
I have a Tinkerboard that i specifically bought to run an influxdb server, and it needed around 1GB RAM just for the service. After a year the system grinded to a halt, and I started fiddling with writeback, kernel parameters.. reinstalling.. 

In the end I bought a new SD card and reinstalled, now working fine. But I got interested in why it is so slow, while showing no data corruption. So I tried a few things:
  • Zeroing the SD card with dd if=/dev/zero of=/dev/sda: No differnce
  • Formatting with Windows SD card formatter: No difference (possible because of USB reader, see below)
Then i ran "fstrim -av" on another SBC and it reported 11GB trimmed  (!) it should be way less I thought, shouldnt trim be running periodically? Then I noticed that the fstrim.timer service was not enabled even though installed. I tried to run fstrim on my slow SD card but operation was not supported when running over USB SD card reader. So to test I ended up writing a new OS image to the card (slow... 1.5 MB/sec). Booting it up in the Tinkerboard MMC slot, dd:ing a file, still slow.

Then I ran "fstrim -a" and after that I had 18MB/sec write speeds.

The fstrim.timer service is not standard on all my debian installations, so what I did was to add fstrim -a to cron.daily on all my SBCs. So what I learned here is:
  • Nothing execpt TRIM command works to "reset" SD card.
  • Most USB card readers dont support TRIM command
  • fstrim is for some strange reason not enabled on any of my SBCs as default
  • Changed my write rates around 1MB/sec to 13MB/sec on most of my SBCs now around 18MB/sec (on par with SD card spec)
  • Influxdb just destroys SD cards... it writes and deletes heavily when sharding(?) data.
  • Docker in itself is also heavy on writes and deletes, if you are developing and trying different images.
My suspicion is that fstrim is mostly thought to work with SSDs, and nobody figured its heavlily beneficial to SD cards too. I can for my life not understand why periodic trimming is not enabled by default on operating systems that are made to run off SD cards. And its been the same on TinkerOS, Raspbian and Armbian.

Forum Jump:

Users browsing this thread: 1 Guest(s)