Lots of discussion about pro/con of the EXT4 filesystem, risks to data integrity without journaling (analogous to a transaction log for a database), the disappearance of the reboot option on Bonsai (and maybe other ROMs) because of this, blah blah blah this, blah blah that, and on and on and on.
There is another solution. You can still have the performance of EXT4, without journaling. With much lower risk to your data in case of the battery leaping out of the phone on a whim. And good ol' reboot can make a comeback too!
The nirvana is a linux command called 'sync'. Crusty old unix hacks like me will get a twinkle in their eye at the mention of this command.
sync does somesthing very straightforward and simple: It syncs the filesystems. Put another way, it flushes the in-ram buffers out to "disk", syncronizing the actual state of the filesytem with what is stored -- and stale -- in secondary storage (hard discs on the big boys, NVRAM/SD/whatever on phones).
I've been experimenting with this to see if I can improve data integrity while minimally impacting performance. Here's what I've done:
- Using GScript Lite, created a simple Superuser script for rebooting that looks like,
/sbin/reboot #Bonsai ROM
Why 3 syncs? Paranoid. Nothing more.
Optionally create a shortcut on the homescreen to invoke this script to easy one-button reboot. I did this a week ago, have been using this to reboot Bonsai 4.0.0 a gazillion (actually, a bazillion, but I'm rounding) times, and have had absolutely no problems at all. Seems to work.
- Created a shell script that launches at boot, as superuser, that runs in an infinite loop waking up every 10 seconds to do a sync. No detectable impact on performance that I can see. This is what I'd expect, as there is never more than 10 seconds of filesystem activity sitting "dirty" in the cache, so the sync doesn't usually have much to do (most of the time, nothing).
What does all this mean? Well, it's sort of a "lazy" journaling, and much more efficient. There's still a higher risk of data corruption under uncontrolled loss of power than with journaling, but in my considered opinion its negligible with the usage model/patterns for this particular situation (a smartphone).
What this means for you
If you're enough of a hack to understand how to implement this stuff yourself, give it a shot (at your own risk!), and let us know how it works out.
For the rest of you, be patient... I'm putting together a package to make it simple to install all this (initially just for the Bonsai ROM, others to follow, maybe), and should have something to test in a day or two. If you're interested in being a tester, PM me. Looking for 10 people.