How long before Rasbian Flash card dies typically?

@wingers1290 Any recommendations on such a power pack? I’ve been looking for a while now, and I can’t find any. As soon as I find one that looks promising, the “fine print” says something like “experiences a 2-second power loss when transitioning from A/C to battery power” or “not recommended for continuous use” or “charges the internal battery only when the [downstream device] is not drawing power”, etc.

Here, this is what I use, but the programming is dead simple. No reason why you shouldn’t try and do it yourself :slight_smile:

http://raspi-ups.appspot.com/en/index.jsp

@eric24 it can be a challenge to find a suitable supply. Anything less than around $50 USD probably isn’t what you’re looking for (the ones I use cost $120 NZD).

If you can get your hands on one, use this: https://www.amazon.com/dp/B00FBD3MVA/ref=nosim?tag=ru018-20

Another great option:

https://www.noelleeming.co.nz/shop/computers-tablets/accessories/portable-power-banks/mophie-3565-pwrstion-xxl-20-powerstation-xxl-20000mah-space-gray/prod150300.html

The ones I use support pass through charge (charge + use at the same time), and have hardware to prevent overcharging. That is the bare minimum you want.

However, as you point out, there is a delay between battery power and AC, but in my case this ONLY occurs when changing in this direction. i.e., switching from AC to battery does not incur a delay. So as long as I detect this change and shut the Pi down before the AC power returns, everything is fine. I figure a typical power cut should last at least a minute, but you might run in to trouble if you experience frequent power spikes.

You will find it difficult to find power banks that do not have this delay, but the first one I linked is an example of one that doesn’t.

Can HassIO be set up to use tmpfs for high write items (ie the log files etc)?
Ideally though, maybe use something like OverlayFS so we could include the database and such? :slight_smile:

+1 looking for a way to minimize number of flash memory writes. This is how I’m monitoring how much data is written by HASS process:

sudo iotop --only --accumulated

And this is an example of how often home assistant writes to flash:

16:14:02
16:14:32
16:14:33
16:15:03
16:15:35
16:16:06
16:17:05
16:17:06
16:17:07

Maybe a way to reduce the writes is to configure sqlite so it uses a cache on ram and only writes to flash when cache is full. Don’t know if what I’m talking make sense or how to configure sqlite for this.

Wouldn’t that result in data loss if the power is cut?

As I understand it, this would A mean data loss, and B I’m not 100% sure this would help, as sqlite is still required to write the same amount of data, you would just be instructing it to effectively delay the write operation.

I’d recommend storing your logs in an external location. This would remove a huge amount of ambient write operations, and plus it’ll come in really handy if you ever need to respond to an attacker owning your network.