Stability Testing an Overclocked Raspberry Pi
Introducing the Overclocking Stability Test Script
The Stability Test Script is a program from elinux.org, described on that site as:
…a script to stress-test the stability of the system, specifically the SD card. If this script runs to completion, without any errors showing in
dmesg, then the Raspberry Pi is probably stable with these settings
Why Stability Test the Pi’s SD Storage?
As noted in Part One of this series, in the early days (and years) of the Pi’s existence there were apparently widespread issues whereby overclocked machines experienced corrupted SD card data. The official, definitive, information on this issue comes from elinux.org: SD Card Usage with Overclocking
Stability of SD card operations when using overclocking is independent of:
- Filesystem type, ext4, NTFS or other.
- SD card vendor.
- The Raspberry Pi model.
- SD card size – verified for 16 GB and up.
What does matter is when you under-power your Raspberry Pi (that is, less than the Raspberry Pi base setup specifications!).
There initially was an increased likelihood of SD card corruption when using overclocking. This is no longer an issue (with firmware from Nov 11 2013 or later).
Nevertheless, it is wise to stability test the SD card; as the same site states:
Most overclocking issues show up right away with a failure to boot, but it is possible to get filesystem corruption that arises over time.
Assistance for those new to Linux
Making changes to the Overclock settings on the Pi, and testing the changes for stability, requires a little knowledge of the Linux command shell. Please see my related post for a basic guide which should help those new to Linux and/or Raspbian get started: Don’t Fear The Command Line: Raspbian Linux Shell Commands and Tools – Part 1
Obtaining and Running the Stability Test Script
Copy and Paste the script into a new file on the Raspberry Pi:
– Connect to the Pi remotely using a remote shell client programme, such as PuTTY, from another machine (Windows, Linux, Android, Mac, etc.)
– use the remote shell client to connect to the target Raspberry Pi, and create a new text file on the target Raspberry Pi:
Navigate to a suitable location in the file system (for example I simply use the existing
Open a new file using the in-built Nano text editor (or whichever editor you prefer). When launching Nano use the
sudoprefix command to ensure the new file can be written back to the filesystem:
sudo nano stability.sh
- Select and copy all of the code
- Paste this into the newly created file on the Pi (if using PuTTY, a right-click of the mouse will copy the contents of the Windows clipboard into the shell).
- Save the file. If using Nano, press
Control + 'X', then
Running the Stability.sh script
Assuming you have created a new file with the filename
stability.sh, at the command line in the location of the script file (or providing a qualified path to that file):
First, ensure the script can be executed (run) by providing the required permissions:
sudo chmod +x stability.sh
Next, run the script:
Note: the script requires write permissions, hence the use of the
Note: to execute a script in Linux it is necessary to provide a path along with the script filename. If the script is located in the currently selected directory, use ‘./’ as the path.
Stability Testing Script – Results
Assuming that no errors occurred during the read or write tests, the script will report:
Not crashed yet, probably stable.
Stability Test Script
Script obtained from elinux.org – it is probably wise to check for a newer version before running this code.
[ Stability Test Script code can be found below the following links ]
A Labour of Love
- Links: Raspberry Pi and Gaming Emulation via RetroPie
- Don’t Fear The Command Line: Raspbian Linux Shell Commands and Tools – Part 1: Just the Basics
- Navigating the Raspberry Pi’s File System. Raspbian Linux Shell Commands and Tools – Part 2
Overclocking and Stability Testing the Raspberry Pi
- Part 1: Overclocking
- Part 2: Stress testing the CPU with mprime
- Part 3: Stress testing the RAM with Memtester
Stability Test Script Code
#Simple stress test for system. If it survives this, it's probably stable.
#Free software, GPL2+
echo "Testing overclock stability..."
#Max out the CPU in the background (one core). Heats it up, loads the power-supply.
nice yes >/dev/null &
#Read the entire SD card 10x. Tests RAM and I/O
for i in `seq 1 10`; do echo reading: $i; sudo dd if=/dev/mmcblk0 of=/dev/null bs=4M; done
#Writes 512 MB test file, 10x.
for i in `seq 1 10`; do echo writing: $i; dd if=/dev/zero of=deleteme.dat bs=1M count=512; sync; done
#Print summary. Anything nasty will appear in dmesg.
echo -n "CPU freq: " ; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
echo -n "CPU temp: " ; cat /sys/class/thermal/thermal_zone0/temp
dmesg | tail
echo "Not crashed yet, probably stable."