All Raspberry Pi models come with either an SD or microSD card slot. Since the Raspberry Pi does not come with any storage built into the device, most users will opt to use the SD slot to run the Raspberry Pi operating system as well as for storing additional files. But, the SD interface can leave a lot to be desired when it comes to speed.
For this reason, some users will choose to plug in an SSD via the USB 3.0 interface, or even a regular hard drive which can oftentimes outperform the speeds of SD or microSD. Before investing in an extra drive for your Raspberry Pi, it would be wise to test the speed of your SD card to see if it is able to provide your Raspberry Pi with the read and write speeds that you are expecting. In this tutorial, you will see how to test the SD card speed on a Raspberry Pi.
In this tutorial you will learn:
- How to test SD card speed via GUI (agnostics tool)
- How to test SD card speed via command line with
|Category||Requirements, Conventions or Software Version Used|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to test SD card speed on Raspberry Pi step by step instructions
For this section, we will be using the
agnosticstool to test the SD card speed on Raspberry Pi. This is only accessible from GUI and should be installed by default, but we will show how to install it in case you do not already have it.
- Let’s start by executing the following two commands to install the agnostics tool:
$ sudo apt update $ sudo apt install agnostics
- Open the system application launcher, then go to Accessories > Raspberry Pi Diagnostics.
- On the Raspberry Pi Diagnostics window that pops up, click on the ‘Run Tests’ button to begin testing the speed of your SD card.
- Once the test has finished running, you will be shown either a
FAILresult, and the option to view the log file to see the details of test results.
A sequential write speed of 10000 KB/sec, random write speed of 500 IOPS, and random read speed of 1500 IOPS is considered good enough to get a
PASSresult on the performance test. This means that the SD card is fast enough to be suitable as an OS drive, and can perform normal read and write tasks relatively quickly.
- Viewing the log file will show you the SD card’s sequential write speed, as well as the random read and random write speed, measured in IOPS.
Testing SD card speed from command line with dd
In case you do not have access to the GUI on your Raspberry Pi, or simply prefer to use a command line tool to do the job, we can use the dd command to test the read and write speed of our Raspberry Pi’s SD or microSD card.
Testing Write Speed
To test the write speed of our SD card, we will try writing 1 GB of data in 10 blocks of 100 MB.
$ dd if=/dev/zero of=./TestingFile bs=100M count=10 oflag=direct
Testing Read Speed
To test the read speed of our SD card, we will use
dd to read our entire
TestingFile file generated from the last command, in 10 blocks of 100 MB each.
$ dd if=./TestingFile of=/dev/zero bs=100M count=10 oflag=dsync
As seen above, our final results with the
- Write speed: 37.9 MB/s
- Read speed: 46.6 MB/s
In this tutorial, we saw how to test the speed of an SD or microSD card on a Raspberry Pi system. As most users will resort to using an SD card as their primary storage for the Raspberry Pi, it is important to ensure that it meets the minimum recommended speeds listed in the agnostics tool, and is also capable of performing on par for the system services that we plan on installing on the Raspberry Pi. If necessary, you can always plug in a SSD drive via USB port for better speed.