A quick way to check SD card speed in Linux command line

I have to prepare several Raspberry Pi boards for some of our small projects. We have a bunch of SD cards we can use. I want to determine which one to use – I want it to be the fast one. I’m using a couple of simple commands to determine write and read performance:

# write
sync && dd if=/dev/zero of=/media/pawel/3166-3032/testfile bs=100M count=1 oflag=dsync && sync

# read
sync && dd if=/media/pawel/3166-3032/testfile of=/dev/null bs=100M count=1 iflag=dsync && sync

I’m using the dd tool, which reads from “if” (input file) and writes to “of” (output file) given amount of bytes (bs=100M means 100 MB of data) at once, repeating “count” times. The resulting file is of size “bs * count”. You can start with a small “bs” if you are not sure how fast the card is.

Here is the result for one of my SD cards:

It looks like we have about 13MB/s when writing, and about 32MB/s when reading. This is quick and easy 🙂

When you have more time, or you want to check if the declared capacity is in line with real capacity, you can use a tool that I shortly described in Testing SD card capacity and speed – in Linux. However, you should clean the drive first (to make it fully available for the tool) and have enough time to run it. Here are results using F3:

As you can see, they are almost identical to the results I got using the dd tool above. Given that you can set the file size in dd, so you can make your test shorter, I prefer this quick way.

Leave a Reply

Your email address will not be published.