I'm looking for a way to have raspberry pi that I can just turn on and off without worrying about fs corruption (not out of laziness but because it is part of a machine that must behave that way) - knowing that the software writes to the disk every few seconds. The worst case scenario must be that some writes are lost if they occurred too early before a power loss, but that everything can boot back up again and keep on working.

  • It could be hardware. I read somewhere that a USB stick inside an e-sata container could do this but I was unable to find any confirmation.
  • It could be software if there s such a way. In particular some library that implements transaction-style writes where either everything is written or nothing is written (in case of power loss) at the end of a transaction.

Thanks for any help

1 Answer 1


It is definitely possible. One way to do it is by setting up a read-only filesystem. When you want to write something, you switch over to read-write mode and once finished, back to read-only again.

The above link is one of many ways to do so, just to get you started. You can find many more examples by googling around.

  • But I'm guessing that the risk of corruption appears again when I switch to RW mode, and as I mentioned that's every few seconds... More than lower risk I'm looking for guarantees.
    – schmop
    Sep 22, 2016 at 22:30
  • 1
    @schmop that I can just turn on and off without worrying about fs corruption is different from before a power loss. I guess you are not talking about the power going off deterministically (like you flipping a switch) because that's easy to handle, but random cut-offs instead. In that case, could you add a small UPS (large capacitor, battery etc.)? See also: unix.stackexchange.com/questions/26516/… and electronics.stackexchange.com/questions/8425/…
    – DimP
    Sep 22, 2016 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.