Gentoo Archives: gentoo-user

From: Michael Jones <gentoo@×××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Gentoo RPi boot to ram or read-only FS?
Date: Tue, 26 May 2020 18:38:34
Message-Id: CABfmKSJtnd9S-Jd=p=m+z5hDU1goUa-w56oxS-nidD3azM-X0A@mail.gmail.com
In Reply to: Re: [gentoo-user] Re: Gentoo RPi boot to ram or read-only FS? by Neil Bothwick
1 On Tue, May 26, 2020 at 1:27 PM Neil Bothwick <neil@××××××××××.uk> wrote:
2
3 > On Tue, 26 May 2020 19:14:18 +0100, antlists wrote:
4 >
5 > > > That's the Gentoo version that I'm using. But I'm looking for a way
6 > > > to make it bullet-proof to having the plug pulled.
7 > >
8 > > Don't use an SD card? Seriously, pulling the power on an SD card has
9 > > been known to corrupt it beyond recovery. BUT.
10 >
11 > Mounting the card with sync will significantly reduce the likelihood of
12 > corruption, at a cost of reduced life.
13 >
14 > > Is the big worry that the home directory will get corrupted etc etc? I
15 > > don't know if you can partition an SD card, but look at doing a
16 > > kiosk-style install with the OS protected and read-only. Then look at
17 > > sticking a loopback device on top of home, so that any changes exist
18 > > only in ram, and are lost on shutdown. Hopefully, that means you now
19 > > have a system that can boot and run off a write-protected SD card :-)
20 >
21 > This will mitigate the reduced life as you are hardly writing to the
22 > card. Booting from a read-only / has caused problems for me in the past,
23 > because of the inability to write to /etc.
24 >
25
26
27
28 Consider a hybrid approach like how many embedded systems do things. E.g.
29 openwrt.
30
31 /root is actually a read-only squashfs image, and on top of that there's an
32 overlay fs that uses a second partition as it's backing storage.
33
34 This way, almost all of your system is purely read-only, but you have the
35 ability to store changes to things you need to store changes for.