Sudden power-off: How to make OrangePi to tolerate it? 看全部

Edited by toxuin at 2016-2-22 13:51

In my 3D printer set up I have an "OH SH*T" button which cuts the power to the machine. It is big, red and you are supposed to hit if something goes wrong. It is wired directly to a power supply. Here's the problem: hitting it effectively shuts power to OrangePi. I know ext3 tolerates corruption pretty good, but practically after only 3 such events my file system went bad.
I am using Ubuntu from loboris, Octoprint (written in python) and nginx on my OrangePi.

Here's an idea how to overcome this: use read-only root. Normally you wouldn't want to do this unless you do not care about the persistence of your data. While I do care about the persistence, I only care about small portion of it (like the uploaded files and logs). This pretty much means I need a read-only root and a r\w partition with all my uploaded crap and octoprint print logs.

I've heared UnionFS can do something even cooler: having a read-only base image and keep all the written changes in-memory. This is kinda cool: you can "sync" what is written once in a while and if a power-loss event occurs you only loose a small portion of data that was created since the last sync.

I also heared that UnionFS is not widely used anymore because there is such thing as Aufs. It is essentially a rewrite of UnionFS targeted to be more stable and robust.

I have no experience with any of those FS. Is it even possible to have a read-only root with in-memory writes, syncing only things I want? I mean, is it possible with OrangePi & loboris's kernel?
I don't think Loboris's kernels are compiled with either of those filesystems enabled. You can always compile the kernel yourself, though. As for your other question: yes, it is possible. That's how e.g. nearly all bootable Linux CDs/DVDs work -- all the changes to the filesystem remain only in RAM, because, quite obviously, CDs and DVDs are not writable the same way a USB-stick or a HDD would be. If you wanted to still be able to keep some files persistent, however, you'd still run into the same issue: sudden power-loss would eventually lead to corruption.

Though, instead of mucking around with stuff like this I'd see it more logical to fix the root problem: your oh-shit - button. Why does it have to cut off power to the Pi when you could just leave the Pi running, but cut power to the printer? Well, you do as you see fit.
  • Bench paco
  • 2016-3-8 20:46:02
you also have seed-device option in BtrFS, although I'm not sure loboris's kernel is compiled with it, but since it's heading to be the default FS in Linux i guess it might be included.
no no no, this is going in the wrong direction.
rather than playing around with different filesystems, why don't tweak ext4?
look at the mount options, they are usually defined for a kinda good performance while somewhat keeping them safe. turn them over to safe (e.g. using sync instead of async, disabling all time-writings and such). you'll certainly have to wait a few more seconds for it to boot, but after that everything should act pretty normal.

since you already have the loboris image with the gpui enabled: if you want to use the GPU to render the timelapse videos, look at a script I developed a few months ago: https://github.com/guysoft/OctoPi/issues/184
I'm highly interested if this also works on orange pis. since I currently only have my raspberry pi 2 hooked up to my prusa i3 I don't wanna rewire everything and check for myself.
I am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me. 作业代写
1234.. 9NextPage