There is a big requirement missing: Do you intend to every update the software? If not, using OverlayFS on top of a read-only 'lower' system might work, although I'm not sure how the Raspberry Pi OS provided implementation then is completely read-only, even while booting up.Can we create a system that will never fail because of a wrong power down?
Depending on how much data you write, you might even have the 'upper' layer in tmpfs, so nothing get written to the SD. If your 'upper' layer is a SD-backed filesystem you should probably handle the case that either the complete file system got corrupted or written files suddenly have 0-length after an unexpected reboot.
If you want to update your system, things get quite a bit more complicated. In that case you have to make sure that all update are atomic, so there is never a non-working partially updated OS in case of an unexpected reboot. The Pi has an A/B booting mechanism (tryboot) added a while back that can help with that. You cannot really use Raspberry Pi OS in that case as a lot of things differ if you chose that road. Try looking into special OS builders like Yocto or Buildroot in that case.
Or just 100% network boot your OS over Ethernet from an HTTP server and only store user data on the SD card. Or get rid of that too and run completely without local storage in RAM only.
Statistics: Posted by dividuum — Sun Dec 15, 2024 8:08 pm