8

Can an OS on Raspberry Pi run with a write-protected SD card? Or is there anything that requires write-access to the SD card when the OS is being used?

  • Linux can run from a read-only root file system. Files that need writing could be put in a RAM-based file system, e.g. tmpfs. – Ghanima Dec 17 '15 at 18:04
  • logs, cache, fake hardware clock etc. will need write access. You may want to look at this question raspberrypi.stackexchange.com/questions/5112/… – Steve Robillard Dec 17 '15 at 18:05
  • adding to what @Ghanima mentioned (re: tmpfs) you can also create a writeable FS on a flashdrive, another SD card or external HD. – Steve Robillard Dec 17 '15 at 18:08
  • 1
    "Snappy Core Ubuntu" for the pi runs read-only by default. – goldilocks Dec 17 '15 at 18:22
  • If this is for security purposes, note read-only on SD cards is only a software-based request and compare to your situation. It may still be appropriate. – Chris H Dec 18 '15 at 8:56
8

The short answer is yes, Linux and by extension, the RPi can be run from a read only SD card, but some things do need the ability to write and then later read from somewhere.

To set up what you're asking for, you have a couple options:

  1. You can setup linux so that the sections of the filesystem that need to be writeable are mounted to tmpfs. This will put all the filesystem writes into a RAM disk.

    The benefits of this solution is that they may speed up your RPi, especially on slower cards, but you will lose information on reboot. This may or may not be a problem based on your setup, but a UPS could significantly reduce the possible impact

  2. Some people prefer that their Pi boots from the SD card, and then loads the OS from a flash drive or eHDD. This will significantly reduce writes to the SD card, and will retain information between reboots. Performance will vary pretty wildly based on the USB device, but it's a viable option.

The details on how to setup either of these is out of the scope of this site, but you should be able to find a tutorial for either fairly easily on Google.

4

Try piCore OS, a Tiny Core Linux based rpi distribution.

Its a special linux distribution that runs from RAM and it needs an sdcard for booting and reading the settings only (read only). You can reboot the pi any time with no risks of corrupting the sdcard.

Heres a link to 6.0 release: http://forum.tinycorelinux.net/index.php?topic=17945.0

  • tinycorelinux.net appears to be dead, at least temporarily. – Jacobm001 Dec 18 '15 at 16:45
  • @Jacobm001 Unfortunately the site is sometimes down, however its very active and has frequent releases. At the moment is up. – Gaspar de Elias Dec 26 '15 at 20:51
2

Nard SDK uses the SD card only during boot and then runs entirely from RAM. It's designed for remotely located long-lived embedded systems.
http://www.arbetsmyra.dyndns.org/nard/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.