Automatically Mounting an External USB Hard Disk on the Raspberry Pi

How-to Guide: Automatically Mount an External USB Storage Device at Boot Time, and Within Emulation Station

Raspbian Logo
External Hard Disk - Image: Clipshrine.com
USB Symbol - Image: Clipshrine.com

This how-to guide shows a method to automatically mount an external USB drive on the Raspberry Pi. The general technique which I have adopted and is common, and whilst there are similar guides available, I have adapted the approach specifically for use on a Pi running Raspbian Lxde Desktop, Kodi Media Center, and Emulation Station with RetroPie.

In this article I aim both to demonstrate and expand upon the steps involved, whilst highlighting some issues which I have encountered when using this approach, and providing their resolutions.

Topics

A Little Background Information

My Raspberry Pi 3 is setup to serve triple duty as a lightweight PC replacement, running the Raspbian desktop, as a media center using Kodi, and as a retro video game emulator suite, via RetroPie. I have my machine set to boot to a custom menu at the command prompt, rather than directly to the desktop, to facilitate easy switching between these options. Please see the Related Posts section for setup guides detailing how this was achieved.

The Raspbian kernel does not automatically mount external USB drives by default; this isn’t an issue when launching the Kodi media center, or the desktop, as both have the capability to detect and mount a USB hard disk or flash storage device once it is connected.

Continue reading

Advertisements

Overclocking the Raspberry Pi 3: Thermal Limits and Optimising for Single vs Multicore Performance

Pragmatic Overclocking

Silicon Wafer - Image: GamersNexus.Net
Silicon Wafer – Image: GamersNexus.Net

Overclocking the Raspberry Pi 3 – Free Speed and Trade-offs

The Raspberry Pi 3, in common with the the older Pi 1 and Pi 2 models, can be overclocked – that is, the main processor, graphics chip, and memory, can be run faster than the default factory settings. Whilst more speed equals more processing power, there’s a trade-off to be considered with the new hardware that generally wasn’t an issue on the earlier systems.

Please Note: at time of writing overclocking the Pi 3 does not appear to be officially sanctioned. This is noted in a post on Gordons Projects, and can be seen in the overclocking entry in the Raspbian O/S’s raspi-config tool, which states ‘This Pi cannot be overclocked’. I do not know whether implementing any overclock options on the Pi 3 will set any internal flags and affect your warranty (early generation Pi’s do so if the Governor is bypassed). If in doubt, wait until the Raspberry Pi foundation makes a statement on the subject.

Raspi-Config Pi 3 - This Pi Cannot be Overclocked
Raspi-Config Pi 3 – This Pi Cannot be Overclocked

Nevertheless, the new Pi can certainly be overclocked. Whilst the process by which this is achieved remains the fundamentally the same, editing the config.txt file, overclocking is not quite as straightforward as it previously has been. The issue is one of thermodynamics, as the new model runs somewhat hotter than the those of the previous generations, at least in the case of the Pi which I took delivery of the day after the new model was released*

* The presence of high CPU temperatures on the new machine could be limited to a certain batch, or an example of the variations in CPU tolerances such as those resulting from lithographic techniques used to create the processors.

Raspberry Pi 3 within Camac Case, with PiHut Heatsink
Raspberry Pi 3 within Camac Case, with PiHut Heatsink

Continue reading

Don’t Fear The Command Line: Raspbian Linux Shell Commands and Tools – Part 1

A Basic Guide to Using Several Handy Linux Command Line / Shell Commands and Tools

Just the Basics

Warped Command Shell. Image - Retro Resolution
Warped Command Shell. Image – Retro Resolution

To customise your Raspberry Pi generally requires a little knowledge of the command shell, even if only running the menu-driven Raspbian configuration tool; the operative word being little.

You don’t need to become a Linux guru to make use of a wide range of handy commands and tools to get the most out of the Raspberry Pi, even when using an all-in-one image such as RetroPie.

You can use the command shell to accomplish tasks including:

  • Obtaining a real-time view of running programmes and processes, including their memory and CPU usage.
  • Monitoring the system hardware, viewing temperature, voltage, and component speed information.
  • Running integrity checks on the filesystem.
  • Moving, copying, and renaming files.
  • Sharing files with other systems on the network, including PC, Mac, and Linux machines, and accessing shared files from those systems.
  • Editing or creating text files, such as those controlling configuration for the Pi’s hardware, and individual programmes.
  • For RetroPie, adding or tailoring configuration to support additional hardware, including USB adaptors allowing the use of original controllers for systems such as the PlayStation, N64, Megadrive/Genesis, and the wireless Xbox 360 pad.
image
Command prompt - Image: pixabay.com

Topics Covered in this Guide

Continue reading

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).

Continue reading

Overclocking and Stability Testing the Raspberry Pi 2 – Part 3: RAM Checking With Memtester

Stability Testing an Overclocked Raspberry Pi
 

Checking RAM Reliability with Memtester after Overclocking

In the third part of the series of posts concerning Overclocking and Stability Testing the Raspberry Pi, we will use Memtester to test the Pi’s RAM.

Raspberry Pi 2 FLIR - Image: rs-online.com
Raspberry Pi 2 FLIR – Image: rs-online.com

What is Memtester?

Memtester is a memory testing tool which:

  • Tests the stability of the RAM
  • Natively runs on a single CPU core, but can be run on all cores using multiple remote SSH sessions, or the Screen tool

The Memtester Man page at Linux.die.net states:

memtester is an effective userspace tester for stress-testing the memory subsystem. It is very effective at finding intermittent and non-deterministic faults

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

Installing Memtester

The Memtester software package can be installed easily using the command line / shell via the Raspbian OS’s APT Package Management Tool.

The APT maintains a repository of available packages, and their dependencies (other packages which a given package requires). Before installing a new package it is good practice to first update the repository list to ensure that you obtain the latest version of whichever package you wish to install, and to avoid dependency issues.

To update the APT repository, at the command shell, type:

sudo apt-get update

To install the Memtester package, type:

sudo apt-get install memtester

Running the Memtester Script on a Single CPU Core

TO Run Memtester on a single core, at the command line specify the memtester program, along with two parameters:

  • 1. The amount of memory to test, followed by a lowercase ‘m’ – do not leave a space between the two. The program will attempt to lock the required amount of RAM, but will use the nearest available amount if this is not possible.
  • 2. The number of iterations to run the test over.

Continue reading

Overclocking and Stability Testing the Raspberry Pi 2 – Part 2: Stability Testing

Stability Testing an Overclocked Raspberry Pi
 

Checking that the system is reliable after applying overclocking

Overclocking is nothing without Stability. Image - www.wallpaper.ge/
Overclocking is nothing without Stability. Image – http://www.wallpaper.ge/

Following on from Part 1 of this post on Overclocking, we turn our attention to stability testing the system; this process is crucial, as simply witnessing the Pi boot to the command shell, or a Graphical User Interface (GUI) isn’t proof that a given combination of overclock settings is stable.

Sometimes an instability will only become apparent after several hours of intensive activity on the system (which is highly likely if using the system for gaming with an installation such as RetroPie).

There are three tools / scripts which I have used in the stability testing processes. For each I will provide instructions on obtaining and installing (or running, as appropriate):

  • MPrime.py
    – Python script to search for prime numbers, which heavily loads the CPU
    – User selectable numeric range to test
    – User selectable number of cores to run upon simultaneously.
  • Memtester
    – Tests the stability of the RAM
    – Natively runs on a single CPU core, but can be run on all cores using multiple remote SSH sessions, or the Screen tool
  • Stability Test Script
    – Reads the entire SD card 10x. Tests RAM and I/O
    – Writes 512 MB test file, 10x.
    – Script can be easily updated to change the number of reads/writes etc.

This post covers the use of mprime. Subsequent posts covers the use of Memtester and the Stability Test Script. Please use the links in the above list to access the relevant information.

Continue reading

Overclocking and Stability Testing the Raspberry Pi 2 – Part 1: Overclocking in Depth

More speed for free?

Silhouette Clockwork - Image Original: andreakihlstedt.com
Silhouette Clockwork – Original Image: andreakihlstedt.com

Overclocking and Stability Testing – Part 1

When using the Raspberry Pi 2 to run any sort of intensive software, which certainly includes emulating classic video games systems using RetroPie, you really need all the processing and graphical horsepower you can get. Luckily there’s more available under the bonnet of the Pi with a little tweaking.

Note: For additional considerations when overclocking the Raspberry Pi 3, please see Overclocking the Raspberry Pi 3: Thermal Limits and Optimising for Single vs Multicore Performance, in addition to the current post.

Topics Covered In Part 1

Topics Covered In Parts 2, 3, and 4

Disclaimer

Overclocking the Pi is supported by tools provided with standard operating system distributions, such as Raspbian, and sanctioned by the manufacturer (with some caveats, as discusssed below). That said, the following details only my own research and experiences with a single Raspberry Pi 2 device; as always, your mileage may vary.

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 posts for a basic guide which should help those new to Linux and/or Raspbian get started:

Overclocking and Power – Use a Quality PSU

When overclocking it is worth ensuring that your Pi is serviced by a good quality Power Supply Unit (PSU), as this is often a point of failure. Not all micro usb supplies, or cables, are up to the task.

Please see my earlier post covering this topic here.

Why Overclock?

The Raspberry Pi 2, as with the predecessor Pi, can be setup to run faster than the default system, effectively giving extra processing and graphical capabilities for free. For retro gaming this can be critical, and is especially true of the N64 emulators, as well as when running more demanding PlayStation releases such as Gran Turismo 2.

Raspberry Pi System Architecture

The Raspberry Pi 2 contains a System on a Chip (SoC), which integrates a quad-core ARM CPU and a Broadcom VideoCore IV Graphics processing unit (GPU), alongside 1GB of SDRAM memory.

Raspberry Pi 2 Model 2
Raspberry Pi 2

Continue reading

Looking after your Pi – Part 2 – General Handling

Following on from the previous post, which covers the importance of using a quality power supply with the Raspberry Pi, this post will cover:

  • General handling of the Pi, electrostatic discharge, and using an enclosure
  • Best practices for connection and disconnection of peripherals
  • Pi shutdown and SD card handling

General Handling

An earlier version of the aforementioned Raspberry Pi Regulatory Compliance and Safety Information (specific to Model A and B variants of Pi) offers some general handling advice, which applies equally to all electronics:

“Take care whilst handling to avoid mechanical or electrical damage to the printed circuit board and connectors.”

“Avoid handling the Raspberry Pi while it is powered. Only handle by the edges to minimize the risk of electrostatic discharge damage.”

Further useful general handling tips can be found in the article Working safely with your Pi, which includes the following advice:

“…in general, turn it off before changing what it’s connected to

The exceptions to this are the USB and Ethernet ports, which are designed to be pluggable. The non-exception to this is the HDMI port which, unlike for every other console or computer you’ve owned recently, you should only connect or disconnect with the power off.

The silent killer for components is static electricity
get into the habit of grounding yourself, by touching something large and metal, before touching the components”

It goes without saying that enclosing the Raspberry Pi in a suitable case can only help increase the robustness and lifespan of the device, aiding in protection against accidental knocks and reducing electrostatic discharge risks.

As noted in the System Overview post on this blog, my Pi is encased in a Carmac enclosure which provides a balance of protection and passive cooling

image

SD Card handling

A helpful guide covering best pratices for shutting down the Pi correctly to avoid SD card corruption is the article 3 reasons why your Raspberry Pi doesn’t work properly from MakeUseOf.com; this also contains further recommendations to use a quality Psu with quality cabling.

If the Pi doesn’t do anything when powered on, one thing to check is the SD card, as noted in in the aforementioned Raspberry Pi User Guide 2nd edition:

“If your Pi’s power light glows when you connect the micro-USB power supply, but nothing else happens and the OK light remains dark, you have an SD card problem”

(chapter 4, troubleshooting)

Related Posts
Links: Raspberry Pi and Gaming Emulation via RetroPie

About
Disclaimers
Privacy Policy
Terms and Conditions
© Retro Resolution

Looking after your Pi – Part 1 – The Importance of a Quality Power Supply (PSU)

When I took delivery of my original Raspberry Pi (Model B) the board arrived packed in a sturdy plastic case, not unlike an audio or DAT cassette box (a reference which instantly shows my age…)

In contrast, the Pi 2 arrived in a flimsy cardboard box, with absolutely no crumple protection.

image

My first Pi 2 actually had to be returned as there was damage to the relatively fragile board. This raised questions in my mind regarding the robustness of the unit, and best practices for general usage and handling.

Some of the topics I’ll be covering in this and the next post are:

  • Hardware damage vs ‘soft’ damage (configuration errors and data corruption)
  • Power supply and usb cable quality
  • Power supply voltage, amperage, and order of connection to the Pi
  • The importance of a 2amp Psu when attaching peripherals via Usb
  • Usb cable quality technicalities: 2828 AWG vs 2824 AWG grades
  • General handling of the Pi, electrostatic discharge, and using an enclosure
  • Best pratices for connection and disconnection of peripherals
  • Pi shutdown and SD card handling

It is important to note that the Raspberry Pi was designed from the outset to be a system for learning about all aspects of computing; as such it doesn’t come housed in a bullet-proof case, it doesn’t come with a power supply that is guaranteed to work, nor does it come with a compatible SD card (which acts as the system’s hard disk, or more accurately, like a contemporary desktop or laptop’s SSD).

Like all consumer grade electronics, it is possible to physically break the Raspberry Pi, and to do so in a manner in which the damage is impossible to discern (such as by electrostatic discharge).

It is much more likely, however, that any damage the Pi suffers is in the form of corrupted configuration or data files (which can be resolved by restoring from a backup – not a problem as everybody takes regular backups of their system… don’t they?). I’ll be covering problems caused by configuration errors and data corruption in a later post

Continue reading

Overview of Raspberry Pi and retro-gaming system hardware

The Raspberry Pi installation to which all of the current blog posts (at time of writing) relate is as follows:

image

Core System Components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B (RS Components)

Raspberry Pi 3 Model B - Image: RS Components
Raspberry Pi 3 Model B – Image: RS Components

Raspberry Pi 2 Model B
Raspberry Pi 2 Model B (RS Components)

image
Raspberry Pi 2 Model 2

The Pi 2 has been overclocked to extract the maximum performance possible, as many video game system emulators push the hardware to the limits. Please see the series of posts on overclocking and stability testing, beginning with part one, for further details.

Power supply: 5 volt, 2 amp micro usb
Official Raspberry Pi Power Unit (RS Components)

Micro SD memory card
SanDisk SDSDQUN-032G-FFP-A Ultra microSDHC UHS-I Class 10 Memory Card
SanDisk 32GB micro SD (Amazon)
I’ve had mixed success with compatibility of cards in the Pi 2 – most have worked; one 16Gb card was unstable under Noobs and Raspbian, but fine with the RetroPie image

Continue reading