Bananian readonly filesystem?

11 8326
Is it possible to mount the bananian readonly in a manner like described here for RPI ?

I need a solution which makes the BPI stable on power loss. I know it from RPI, that on power loss the FS on SD is corrupt in most cases. This prevent's users to use it for Car PC etc.

I tried to follow the manual in the link above but see, that the /etc/fstab is, except swap, empty. So my question is, will the procedure work on bananian too? I'm not a Linux crack to explain this things by myself. If it not works this way, somebody can post a procedure to do it?

Post Last Edited by tkaiser at 2014-10-10 10:33

Reply 1# dutchman

I tried to follow the manual in the link above but see, that the /etc/fstab is, except swap, empty

Try to replace the line
  1. ROOT_MOUNT=$(awk '$2=="/" {print substr($4,1,2)}' < /etc/fstab)
Copy the Code
  1. ROOT_MOUNT=$(awk '$2=="/" {print substr($4,1,2)}' < /etc/mtab | head -n1)
Copy the Code
And just add the 2 lines starting with 'mount_unionfs' to /etc/fstab.

But maybe you're trying to workaround a hardware problem with a sophisticated software 'solution'? If you've problems with continuous power supply I would give hardware a try that contains support for LiPo batteries. Eg. the Olimex stuff. When you don't need two CPU cores and that much RAM then it might also be cheaper: ... pen-source-hardware

Reply 3# Bananian

@Nico: Does this Battery support being charged while it powers devices?

Reply 4# tkaiser

I don't know but will try when I am back home

It is possible (although I didn't try it myself on bpi). Bananian is mostly Debian, and Debian has pretty detailed guide how to make root filesystem read only

Long time ago I played with semi -RO filesystem on my router with regular Debian and x86 architecture. Here are some notes (pl). Semi, as I had symlinked some directories to USB HDD.

BTW remember to turn of journal if you really want to have RO filesystem. BTW if nothing writes to FS and you don't have journal, it's very unlikely to get FS corruption, even if it is RW.


main problem making the root-FS RO are files which are normally written to, /etc/mtab for instance, and some other in /etc. And the logfiles in /var/log and it's subdirs and /var/pid for instance, and /tmp. You can try to mount a tmpfs for this objects, but for some it is better that they don't get destroyed thru a normal reboot, so they should better be saved in the root-FS when a normal shutdown is performed. The folks from have implemented this for their Voyage, and it should also be possible for Debian. Maybe it is easier with a more embedded-targeted Linux like OpenWRT (no offense against Bananian).


@gbi: thats why I linked to the RPI manual. They mount /var and /etc into RAM with unionfs. I made this on two RPI and never had problems with corrupt SD card again. In case of installing or updating software it's only needed to make a
  1. sudo mount -o remount,rw /
Copy the Code
Installing/updating what you want and sync the ro folders with
  1. sudo rsync /etc/ /etc_org/
  2. sudo rsync /var/ /var_org/
  3. sudo mount -o remount,ro
Copy the Code
Thats really noob save and your device is save in case of power loss. If you need things (logs) which need to be saved permanently you can use a separate USB stick or a NFS device.

Reply 8# dutchman


ah, unionfs. In Voyage they made kind of an archive which is unpacked at the start of the system to a tmpfs, and is packed on shutdown, and written to SD (at least as far as I can remember when I had the last look at Vovage). Unionfs long had the prob not be be in the vanilla kernel, I'm not sure about the recent state, and do also not know about the state of unionfs and the customized sunxi kernels. Maybe aufs (which is at least in the recent Debian kernel) is the better choice than unionfs.

A RO rootfs would be a nice thing to have, as the BaPi is kind of an embedded system (at least headless), which for sure is not always shut down with a clean filesystem.

I'll have a look into my BaPi wether there is unionfs or aufs support in the recent 14.09 kernel


@gbi: they use the userpace unionfs because it's not in the kernel. Related to the other things you wrote - I'm a noob and would need a step by step manual.

You have to log in before you can reply Login | Sign Up

Points Rules