Subject: hybrid setup idea

From: Jerome Marc <[email-masked]>
Date: Mon, 30 May 2022 15:46:15 +0200

Hi all,

I'm running a diskless setup on a Raspberry PI. Problem is I am missing
memory because my SBC only has 512Mb sdram.
This is more than enough to run tiny things like nginx but I just tried to
install docker. About 200mb software installed, my root filesystem is
almost full.
I really like the diskless approach but I miss the system install for the
storage and memory capabilities.

So I wonder why can't we have both ? I have seen numerous examples of
mixing ext4 root fs with tmpfs mounts in order to keep the root fs
read-only.
That's interesting but very customized, not generic.

I had another idea that would leverage overlays. I could use a lower layer
stored in the sd card and an upper layer stored in tmpfs.
The lower layer could be read-only and filesystem write operations would be
applied to tmpfs only.

The question is how to maintain such a system ? Would be perfect if apk
could upgrade the lower layer. overlayfs doesn't support the lower layer
updates unfortunately.
I was thinking about this logic :
remount rw the lower layer fs -> chroot using the lower layer as root ->
run apk -> exit chroot ->  remount ro the lower layer fs -> remount the
overlay fs

I think it would be fairly easy to write a wrapper (apk-persist) to
automate everything.

btw I have seen an overlays folder in the boot partition of Alpine. What is
the purpose of this ?

Thank you