Read-only Root Filesystem

From a thread that I came across a thread on Raspberry Pi forum:

A read-only root filesystem can prevent sdcard corruption when the Raspberry Pi suddenly loses power. Protecting against sudden loss of power is especially in important for IoT and embedded devices because it is common to forcefully power cycle them when something needs reset.

This can be great for servers & setups that use only external disks for data storage.

Can this work on Manarjo ARM?

Source: Raspbian with Read-only Root - Raspberry Pi Forums

Or, you can rely on the journal and recovery capabilities of an ext4 filesys for ROOT and simply unmount BOOT (e.g. via a script) after boot to protect the msdos/fat filesystem there. Just my 2 cents…

BOOT still needs to be mounted but in read-only mode and only disabled during system updates.

But then this is a simple solution, no?

Depends on your experience :slight_smile: How can I do this in Manjaro?

I haven’t used an RPi for many years so I don’t know about the specifics (for linux on RPi), but there is one system file in standard linux distros that is sort-of made for this; rc.local. It is typically run last in the boot process, when everything else is done, but nowadays with systemd etc. there might be a better solution. Otherwise, try putting a line in rc.local which remounts /boot in ro mode; this is from man mount:

The alternative (classic) way to create a read-only bind  mount  is  to
       use the remount operation, for example:

              mount --bind olddir newdir
              mount -o remount,bind,ro olddir newdir

FWIW I’ll be doing this on a RockPi4.

what would be the line to put in rc.local?

You have to do a little reading up (since I don’t know the specifics, and my above snipped may be wrong, or not the best way) on the mount command, and try it first from the command line.

1 Like