LibreServer Blog / Improving read/write performance

I've been running small computers on EMMC or microSD cards since 2010, so I know that when it comes to reading or writing things to disk performance can be quite sluggish. This is one of the reasons why I usually turn logging off, because anything which might be often writing to disk is going to slow things down.

Recently I was wondering whether there were any software or kernel tweaks which I could do to try to improve microSD performance. I found a few things which may make a small difference, but the overall answer is that there isn't much you can do other than buy the best quality Sandisk or Samsung microSD you can find. Running some benchmarks I found that microSD read speed can vary wildly from about 22MB/s all the way down to 5MB/s, with the variations happening for no obvious reason but probably due to the underlying microcontroller logic on the memory card itself as it does things like wear leveling.

I bought a Cubieboard 2 in 2014 and it has been used (and abused) quite extensively for testing Freedombone image builds. It has the option to connect an external drive via a SATA cable, but I had never tried doing that because I assumed that a secondary power supply would also be needed. It turns out though that isn't the case, so I was wondering whether I could actually boot the file system from SATA. According to the Cubieboard wiki the answer appeared to be no, or at least not directly.

Normally single board computers only boot from EMMC or microSD, but there's a way to work around this limitation. What you can do is have a boot partition on the microSD card which then points to the main rootfs on a SATA connected SSD or hard drive. This is fairly easy to do by modifying the root path within a file called boot.cmd. I modified the freedombone-image command with an extra --sata option to do this, and so long as you copy the resulting image both to the microSD and the SSD then it works.

This is one of those things which is so ridiculously simple that I wonder why I didn't do it four years ago, but I was mostly focussed upon the Beaglebone Black as a platform, Debian support for Cubieboard was extremely basic and there were a ton of much higher priority problems to solve at the time.

The end result is that running on an SSD the disk performance on Cubieboard 2 is at least an order of magnitude faster, and this is quite pleasing since it means that using these A20 based boards for things like NextCloud or Syncthing is a much more attractive proposition.