Read-only Raspberry Pi script: how to secure a micro SD card so nothing can be written to it

The MagPi issue 94 out now

Introducing Raspberry Pi 4 with 8GB RAM. With twice the memory as any previous Raspberry Pi, and 40 times the power of the original board; the new 8GB model is a monster! Discover what you can do with the ultra-powerful Raspberry Pi 4 in this month’s edition of The MagPi magazine.

If you’ve ever built a Pi for a kiosk, installation or information display, you’ll find Adafruit’s read-only Pi script invaluable. This script disables all the write-to-SD-card functions, meaning that you can pull the plug without any risk of data loss or corruption.

The Adafruit script forces Raspbian to store all its temporary data in memory, so no data stored on the SD card can be corrupted. This also means that nothing at all can be written to the SD card.

Adafruit Script puts Raspberry Pi in read-only mode

Script author, and Adafruit Creative Engineer, Phillip Burgess tells us, “We’re seeing Raspberry Pi really take off in situations where a microcontroller may have once sufficed,” and points out that less technical users are making things with a Raspberry Pi. Phillip wanted the ability to simply cut power like one does with an Arduino or a consumer product.

Phillip’s script includes ways to disable read-only mode, by use of a jumper or quick button connect

The script only works on Lite installations – “Stretch or Jessie should work,” Phillip tells us – and you can find the full instructions at Adafruit.

Russell Barnes

Russell runs Raspberry Pi Press, which includes The MagPi, Wireframe, and HackSpace magazine, and book projects. He’s a massive sci-fi bore.

Subscribe to The MagPi magazine

Save 37% off the cover price with a subscription to The MagPi magazine. Try three issues for just £5, then pay £25 every six issues. You’ll save money and get a regular supply of in-depth reviews, features, guides and other PC enthusiast goodness delivered directly to your door every month.