
Raspberry Pi microSD card performance comparison - geerlingguy
https://www.jeffgeerling.com/blog/2018/raspberry-pi-microsd-card-performance-comparison-2018
======
ChuckMcM
This was a good comment from the author --

 _" I've tested the ODROID-C2, Orange Pi, and am finishing up testing on the
ASUS Tinker Board, and all of these boards are leagues beyond the Pi in terms
of I/O performance (both networking and local storage). The problem is most of
these boards are either priced the same as or more than the Pi 3 B+, and have
a much worse initial onboarding experience (grabbing a disk image, flashing
the card or onboard memory, first boot, then figuring out where to go next)
than what you get with the Pi and it's handy, well-written tutorials."_

That is the only reason that the Raspberry Pi maintains its position of where
it is. It isn't a great computer, it is a great ecosystem. So often when I
talk to people about my efforts in that space I get the "but my computer is so
much faster than that" and I just nod. When the environment is the same on all
machines (like it has been in the WinTel era) then its all about the specs of
the machine. But when the environments are all different, its all about the
environment.

~~~
digi_owl
Indeed. I can grab RPi and accessories virtually at the local mall (or at
least i keep seeing ads for them from various store chains).

ODROID? Forget about it, has to order from abroad. Tinker Board, not sure. I
think i have seen one specialist online store offer up the Orange PI.

------
jscheel
I would just be happy if my rpi would not randomly corrupt the memory card for
no reason all the time. Have it on a quality adapter, hooked up to a ups, with
a quality card, yet it still corrupts itself for no reason.

~~~
monocasa
I worked on a project professionally to find out why we were corrupting SD
cards. Turned out that the SD card firmware is just garbage in a lot of cases.
Ended up with a test program that could corrupt an SD card from a given
manufacturer within a couple hours with slow (80kb/s) continous reads and
writes from any hardware running Linux. The manufacturer couldn't have cared
less and essientially blew us off despite having a support contract.

Long story, short, buy 'industrial' SD cards if you care about them not
getting corrupted.

~~~
more-coffee
Been in a similar boat. Management said we couldn't afford industrial cards
because it would kill the margin on the embedded devices they were used in, so
we had to make it work with 3$ p.o.s. cards, which would corrupt after 6-12
months.

Ended up mounting /var on a tmpfs - ensuring practically no writes to the card
- and fetching the device configuration from a server in the network at boot.
PLenty of work, with zero (or negative) profit for the company, but at least I
learned a thing or two doing it.

~~~
amag
Yup, been there too, way, way back.

We wrote simulation tools for typical access patterns and ran them heavily for
testing out new cards, both for performance and failure rate. Luckily there
was enough margin on the devices that we (R&D) could select the more expensive
industrial graded cards by good manufacturers, but I did get to see some
really shitty cards that purchasing preferred (because they had gotten a great
price on them).

However in our case the corruption was due to a buggy FAT-driver for the
obscure RTOS we used. In the end though I learned a lot about FAT which was
fun (<sarcasm>and is a highly marketable skill these days</sarcasm>).

~~~
monocasa
Haha, I ended up tapping all read and writes to the card, intending to catch
our crappy FAT driver in the act of corrupting.

Turns out the card itself was shit and replaying the trace would just kill
arbitrary cards.

~~~
michaelt
How does one tap all the reads and writes to a card?

~~~
hazeii
Just intercept the read and write calls! On linux you can just use 'strace
$prog'; try it on a minimsal program that reads and writes a file. For a
custom approach, this can be done with a library (using LD_PRELOAD). Plenty of
articles about how to do this, e.g.
[http://www.linuxjournal.com/node/7795](http://www.linuxjournal.com/node/7795)
(essentially the same technique on Windows, or other OS with shared libs).
Slightly more hardcore is to hook the kernel syscalls; not normally necessary
(on linux this is effectively hooking the other side of glibc, where it talks
to the kernel) but if all you've got a static binary it's one approach.

Note that all these techniques only show you the read and write calls made to
the library/OS and - importantly - not what actually happens to the card. To
see that, the next level down is to instrument the card driver to track the
actual I/O operations (i.e. so you see what the card is really being asked to
do, sans all the caching and buffering).

Note that's not the end of the story; there's what the hardware controller
decides to do and when the hardware actually reads/writes the flash array.
That's the level where the quality of the firmware in the controller(s)
matters.

~~~
michaelt
Doesn't that mean you then have to write an event to disk for every write-to-
disk event?

~~~
sowbug
I would log by RPC or whatever to a remote computer.

------
rubatuga
Is raspberry pi trapped in its own architecture? The Broadcom SOC chosen 5
years ago may have seemed like a good choice then, but the raspberry pi
foundation is now facing an uphill battle since Broadcom doesn’t seem to be
providing any significant updates to the raspberry pi, other than clock
increases. You have the whole codebase based around this one chip, and I worry
that this will mean painful migrations if raspberry pi ever switches to a new
architecture

~~~
duskwuff
Er... what? The SoC has received multiple major updates. The Pi 3+ has a a
quad-core, 64-bit SoC -- it's the same SoC family as the one in the original
Pi, but a rather different CPU core.

~~~
gitgreen
Yup. The Pi has been based on ARMv8 architecture since late 2016, the same
architecture that the latest Apple mobile chip(A11) is based on. There's
plenty of room to grow in the Broadcom line. The only part that really needs
attention is the bundled GPU which IIRC has never been updated since the RPi
has been introduced.

~~~
gruez
> Yup. The Pi has been based on ARMv8 architecture since late 2016, the same
> architecture that the latest Apple mobile chip(A11) is based on.

that doesn't mean anything, other than that it runs arm64. in every other way
it's nowhere close to A11.

------
rmu09
I got 3 Samsung EVOs (from 2015 or so) that got stuck in a kind of "read only"
mode after some months in the Pi. All seems normal for some time, but writes
are not persisted. After some time linux gets confused and panics. After
rebooting, FS is always in exact same state.

~~~
cmurf
Same. I have a 32G Samsung EVO+ I use in a NUC with Linux that just went "read
only" this week. 10 year warranty, and it's already setup for warranty
replacement, which is sorta hilarious seeing as it cost $12, including the
adapter (which itself is only warrantied for 1 year). I got 360 days out of
the card, non-continuous use. But also interesting, they want the bad card
returned to them - they're including a prepaid return shipping label.

The usage was just as a boot drive no user data: EFI FAT, ext4 /boot, Btrfs /
using zstd and ssd_spread as the mount options.

FAT will mount ro or rw, but any writes fail

    
    
        [140718.615921] print_req_error: I/O error, dev mmcblk0, sector 2048
        [140718.615998] Buffer I/O error on dev mmcblk0p1, logical block 0, lost sync page write
    

Ext4 is similar but a lot more complaints from the mmc block driver, including
an SDHCI REGISTER DUMP [1] which I can't make heads or tails of, but this is
somewhat more revealing:

    
    
        [142132.340226] f28s.local kernel: mmc0: Card stuck in wrong state! mmcblk0 card_busy_detect status: 0xf00
    

Btrfs also has lots of complaints [2] but mainly because it never gives up
trying to write. So cancel that and mount with '-o ro,norecovery' and
everything is there. One thing you'll see in the Btrfs output, is "corrupt 10"
which is not a current event, just a counter that I never reset. A few months
ago I did have a data file (not fs metadata) become corrupt which Btrfs
caught. I was able to reinstall the RPM that provided that file. So who knows
how that corruption would manifest without being caught by the file system.

The blkdiscard command succeeds without error, but also doesn't actually do
anything, all data is still there.

[1]
[https://drive.google.com/open?id=1Lbypuut21PreXnzHj9uC0x6lxK...](https://drive.google.com/open?id=1Lbypuut21PreXnzHj9uC0x6lxKsgkxnX)

[2]
[https://drive.google.com/open?id=1340GQN29j8Ougtj_E0ey3A_RUJ...](https://drive.google.com/open?id=1340GQN29j8Ougtj_E0ey3A_RUJyPgtvW)

~~~
written
Sounds too cheap, are you sure it's not a fake?

~~~
cmurf
Local reputable store, f3 had no complaints and is the claimed size. Samsung
wanted a copy of the receipt and a photograph of the back of the card itself
before replacing it so presumably they're satisfied it's legit. It might've
been on sale for a few bucks off, I don't recall. Newegg has it for $15.
_shrug_

------
bullen
Thanks for finally finding the search terms I needed to discover this:
[https://www.digikey.com/product-detail/en/panasonic-
electron...](https://www.digikey.com/product-detail/en/panasonic-electronic-
components/RP-SMTT64DA1/P122040-ND/6596412)

Looks like my RPi 2 cluster is getting an upgrade!

~~~
bullen
Hold your horses, this is better:

[https://www.digikey.com/product-detail/en/panasonic-
electron...](https://www.digikey.com/product-detail/en/panasonic-electronic-
components/RP-SDXE25DA1/P122432-ND/7561402)

and

[http://eshop.sintech.cn/sdhcsd-card-to-micro-sd-tf-
extender-...](http://eshop.sintech.cn/sdhcsd-card-to-micro-sd-tf-extender-
adapter-card-for-mobile-pho-p-866.html)

or

[http://www.saikosystems.com/web/p-44-sd-to-microsd-
converter...](http://www.saikosystems.com/web/p-44-sd-to-microsd-
converter.aspx)

Depending on your location.

------
amq
Would be also interesting to compare power consumption. Different microSD
cards can range from 0.06 to 1.34+ mA in idle, which can be more than a
microcontroller like ARM M4:
[https://electronics.stackexchange.com/a/123386](https://electronics.stackexchange.com/a/123386)

------
kobayashi
Has anyone found there to be a noticeable difference between a Lexar (or the
like) and a Samsung Evo+ when using a Pi-Hole?

~~~
geerlingguy
When using Pi-Hole, the difference isn't that great. It's more network-
latency-constrained (and maybe CPU) than anything else. But the difference is
so small in my testing with Pi-Hole that I don't think it's worth worrying
about _too_ much. For many other use cases, there would be a very large
performance delta!

~~~
kobayashi
Thanks very much — both for this reply and for all your write-ups!

------
tischler
Why is that significantly slower than the specs of these SD cards (100-80 MB/s
read/write)?

~~~
itakedrugs
The RPi is more then likely the limiting factor... kind of makes the tests
useless if you want to figure out which cards are faster

~~~
khedoros1
If I'm remembering correctly, the Pi's SD reader runs at 50MHz, doing 4-bit
transfers, and not using any of the UHS signaling methods, because those use
1.8V signals that the Pi isn't set up to use for SD.

> kind of makes the tests useless if you want to figure out which cards are
> faster

But...which card is faster in a USB3 UHS-III transfer isn't useful information
for a Raspberry Pi benchmark. It would certainly tell you which cards are
faster, but the info wouldn't be directly applicable to what the tests are
trying to measure.

------
hyperpallium
Is this also applicable for androids?

I got a cheapie sdcard, which slowed my phone noticeably. On amazon, reviewers
say (as here) that random RW are the key metric, and (at that time), the
sandisk sdcards were the best.

~~~
khedoros1
Android phones use the SD card in a more computer-like way than a camera-like
way, so random rw is important. There's actually an "app" rating introduced in
the last year or two, but I think most manufacturers haven't bothered to get
their cards certified yet. But some Sandisk cards now have an "A1" or "A2"
marking on them, which represents application performance.

------
jokoon
The debian on rpi should not have its swap on the sd card, clear and simple.

A solution would be to have some filesystem on ram, and write new
changes/deltas to the SD card either periodically, or at shutdown.

------
mobilemidget
Nice test!

Perhaps nice to add comparison to network storage/boot?

------
TheForumTroll
Interesting. I wonder how bad the other cards are in comparison to not warrant
a test at all.

~~~
geerlingguy
See my post from 2015: [https://www.jeffgeerling.com/blogs/jeff-
geerling/raspberry-p...](https://www.jeffgeerling.com/blogs/jeff-
geerling/raspberry-pi-microsd-card)

I re-tested a couple of the cards (notably, the Sony and Kingston cards), and
they were just as painfully slow. The benchmarks took like 20 minutes (with
the faster cards they only take 3-4 min).

If you use knockoff cards (no brand at all, like one that came with one of my
cheap drones), the performance is so abysmally slow you might think the Pi
locked up for a few hours.

~~~
kobayashi
Do you think that these top-tier cards are necessary for use in a Pi-Hole in
an average home? Or is something like a Lexar card good enough?

~~~
khedoros1
Pi-Hole ends up booting, then probably mostly running in RAM, anyhow, right? I
think it's just running as a DNS proxy. So you'd slow down your initial boot,
but probably not hurt performance of the device much (unless I'm wrong, and it
_does_ need to read and write data often).

------
VMG
wondering if I should just mount my external spinning platter hdd as root
instead

------
mv4
looks like that NOOBS card doesn't perform well at all

~~~
geerlingguy
It's better than the no-name cards, and even slightly faster than some of the
secondary-brand cards (Transcend, PNY, Sony, Kingston, Toshiba).

It's not a terrible choice for a starter card, but you can get the Evo+
cheaper for the same capacity, if you can stand to flash it yourself :)

------
wemdyjreichert
This feels like an LTT video.

