Main Content

Read-Only Raspberry Pi

Overview

Most microcontroller projects have an on/off switch or some quick way to cut power, while computers like the Raspberry Pi require an orderly shutdown procedure…otherwise the SD card may become corrupted and the system will no longer boot.
Sometimes just cutting power would be a convenient timesaver, or a system may be left to non-technical users. For installations that don’t require creating or modifying files — such as a dedicated slideshow kiosk — we can configure the operating system to make it more resistant to unplanned power cuts.

The Concern

Linux — or any substantial computer operating system, Windows and Mac are the same way — behind the scenes they’re reading and writing all manner of temporary data to drives (or the SD card with Raspberry Pi). This is why we normally use the shutdown command: all those files are put away in a known valid state. But if power is unexpectedly cut, these lingering half-written files can render a card unbootable…one can try patching it up, but sometimes there’s no recourse but to wipe the card and reinstall everything.

The Solution

The script we provide here adapts Raspbian to work in a read-only mode. Temporary files are stored in RAM rather than on the SD card, making it more robust in this regard. You can just unplug the system when done. The tradeoff…as the read-only name implies…is that nothing can be written to the card in this state. Can’t install software, can’t record pictures. So it’s not the solution to every situation, but may be helpful with certain passive tasks…a slideshow kiosk, a Fadecandy server, a Halloween display, etc.
Optionally, you can use a jumper or switch to boot the system into normal read/write mode to install new software or data. And, as normal, you still have easy access to the /boot partition if the SD card is mounted on another computer.
This guide is based partly on instructions from petr.io, which in turn credits Charles Hallard and Mario Hros…along with community members’ contributions in those threads and some changes and additions of our own.”

Link to article