ReadOnly FileSystem


i’m using beaglebone for monitoring devices, with a custom C program.
I need to protect file system for secure it on power interruption or not safe poweroff.

I want to mantain writable only one folder (for example /opt/data/) or mantain writable only sdcard to write log or temp files.

do you have any suggestion?

Thank you

This is possible to do, but you will need to do some changes.

To start with you need to have the OS on the internal eMMC and mount it read only.

Use an SD card ( or USB stick) for your writable needs. You will need to do a disk check/fix/format on boot in case of corruption or it won’t mount, or will mount read only.

For some things that need to be writable ( e.g. /tmp, /var ) they need to either be mounted as RAM drives in which case you will obviously lose anything when powered off if you do this, or mount them on the SD card.

It is easy to use a RAM drive as you don’t have to worry about checking before use.

It takes quite a bit of work to get this going.

You should also make sure u-boot does not do any writes to the eMMC just in case you get a power off at that instance.

Edit: I will add it is probably easier to add some form of battery backup to give yourself enough time to shutdown cleanly.

1 Like

There’s been a project in the default install for a few years now… “overlayroot” it just requires a bootarg setup in /boot/uEnv.txt…