I am installing my board in a remote location with an unreliable power
When running Debian, it will quickly become corrupted if it is not
shut down properly. What is the best distro to use that allows for
power to be cut?
Some sort of read-only distro or a distro that write itself completely
I have been running Debian on all manner of little boards for 5 years
in rural locations like farm barns. So lots of power breaks (no UPS)
and glitches. This was before there were good
NAND file systems in the kernel (2.4.something-small), but just after ext3
was released. I don't even mount it read-only. In that time I have
NEVER had a corruption and I have only had one CF drive fail on me. Oh
yes, and I did not stop logging.
Buit if you want a distro designed for r/o, you would try OpenWrt, but I am
not sure if they support the Beagleboard yet.
You should be able to mount your file system with the sync option so all writes will take place right away and are not cached. This will reduce performance and may be harmful for the flash but for just testing and playing around should be fine.
With a journalling filesystem you become much more resiliant to power failures and fsck usually returns quickly having fixed up any issues. However, if you want to be sure there isn’t going to be any filesystem corruption then you can just set the rootfs to be mounted readonly.
You’ll find that a lot of things simply won’t start if they can’t write their files… There’s a couple of options for that…
(a) mount / symlink writeable directories to a second parition. On boot delete the partition and unpack it from a known good state. Simple, but needs a lot of research to work out what needs to be written.
(b) use aufs or unionfs to stack a writeable layer on top of the readonly layer. On boot you can check the writeable layer for errors, try and fix them or just delete it. I would suggest using an actual disk parition for the writeable layer rather than RAM as the BB hasn’t got lots to spare.
Knoppix for x86 is a good example of a distro that does this. Its concepts should port to ARM without any issues.