Overclocking and Stability Testing the Raspberry Pi 2 – Part 4: SD Storage Testing

Stability Testing an Overclocked Raspberry Pi
 

In the final part of the series of posts concerning Overclocking and Stability Testing the Raspberry Pi, we will be checking SD Card Storage reliability with the elinux.org Stability Test Script.

Smashed Hard Drive – Image: thefileroom.com
Smashed Hard Drive – Image: thefileroom.com

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 /opt/ folder)
  • Open a new file using the in-built Nano text editor (or whichever editor you prefer). When launching Nano use the sudo prefix command to ensure the new file can be written back to the filesystem:
    sudo nano stability.sh

– Obtain the source code for the Stability Test Script either from elinux.org, or the copy of the script provided below.

  • 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 'Y'

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:
sudo ./stability.sh
Note: the script requires write permissions, hence the use of the sudo prefix
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.

Raspbian Command Line - Launching the Stability.sh script
Raspbian Command Line – Launching the Stability.sh script

Stability Testing Script – Results

Assuming that no errors occurred during the read or write tests, the script will report:

Not crashed yet, probably stable.

Raspbian Command Line - Stability.sh script completed run
Raspbian Command Line – Stability.sh script completed run

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

Retro Resolution is entirely a labour of love. Please consider offering a donation if the information here has helped illuminate, enlighten, or otherwise assisted you!
Donate Using PayPal

Related Posts

Overclocking and Stability Testing the Raspberry Pi

About
Disclaimers
Privacy Policy
Terms and Conditions
© Retro Resolution

Stability Test Script Code


#!/bin/bash
#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

#Clean up
killall yes
rm deleteme.dat


#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."

4 thoughts on “Overclocking and Stability Testing the Raspberry Pi 2 – Part 4: SD Storage Testing

  1. Just curious, how long should stability.sh take to run? I’ve been waiting half an hour, and “reading: 1” is the last line printed. The cores are all pinned and sitting at 70C (checked by opening a second ssh connection), and I can obviously still access the device, so it doesn’t appear to have crashed.

    Like

Please Leave a Reply! Anonymous comments and 'markdown' formatting enabled.