Home Assistant + Raspberry Pi + Failing SD Cards + Databases

SauRoNZA

Honorary Master
Joined
Jul 6, 2010
Messages
61,592
Reaction score
23,276
Location
Cape Town
So with load shedding getting on my nerves it's a bit problematic to run my Unraid box through out an entire load shed and so I figured maybe it's time to move my Home Assistant Docker over to Hass.io on a Pi and some specific Dockers that are mission critical to go live on that.

My question relates however to everyone complaining about SD cards eventually dying because of read/writes to the DB constantly.

1. I already use InfluxDB so I can pump it into Grafana. Does this mean there are no "local" writes and everything is going there? Does doing this save the SD card or do I need another solution?

2. In the event of Load Shedding and my Unraid box shutting down, taking InfluxDB along with it what happens to Home Assistant? Does it just write nothing during that period? Does it fall over?

3. Does the same crap apply to things like MQTT? It also has a persistence database after all. Or is that low frequency enough not be an issue.

4. Isn't it possible to simply skip the SD part and do something else? I'm sure money is the real problem there so what are cheap options?

*** I have never even fiddled with a Pi so I have no clue on the hardware front what can and can't be done or supported.
 
These are some really good questions that I'd like to see some answers too.

One of the simplest questions is whether you can not just run HA from an external, USB drive on the Pi (i.e. an SSD). As far as I know, it isn't possible at this point to use Hass.io to do it -- but there seem to be some guys out there that run another Linux distro on the Pi and then run Hassio in Docker. This is something that could work in your situation.

Personally my biggest frustration seems to come from the SQL Lite DB -- if I start experiencing slowdowns, I delete the built in DB (and then HA recreates it at reboot) and all is well again. That's one of the reasons I want to try moving out my DB to external -- but then I don't want HA to start writing out persistent logs onto the SD card and corrupt it that way.

DB errors are usually also one of the first indications that an SD card is going to fail, which points to me to the same underlying problem.

So I'd say things to explore:
1) Run Hassio with external DB on network (and see what happens if the DB is unavailable)
2) Run Hassio in Docker on the Pi running another OS, and make sure the config and other files are stored on an SSD
3) Explore another alternative

I don't really find the Pi too slow -- all my automations happens instantly unless there's DB / SD Card problems.

Pi's are super simple to work with -- it really is just a mini Linux PC. It is only if you want to start messing with IO pins and Camera addons etc. that you'll "dip into the hardware layer". You'll do fine ;)
 
The problem there is you can’t actually run Hass.io in a Docker, only Home Assistant which is what I’m doing now.

If I make the switch I want the benefit of Hassio without all the manual labour.

It makes sense that you wouldn’t be able to mount a separate volume if they don’t support it, I simply assumed the SD card would disappear and be rewired to an SSD or whatever.
 
The problem there is you can’t actually run Hass.io in a Docker, only Home Assistant which is what I’m doing now.

If I make the switch I want the benefit of Hassio without all the manual labour.

It makes sense that you wouldn’t be able to mount a separate volume if they don’t support it, I simply assumed the SD card would disappear and be rewired to an SSD or whatever.

There are guys that seem to be doing it:
 
Sorry I should have made it more clear that while it’s not impossible it’s like the Inception of OS installs and just generally doesn’t seem like a very good idea to me.

But maybe I should just try it.
 
It seems the correct answer is actually an Intel NUC.

Didn’t know that was a native option.

Might be a good idea actually as I could push more stuff through Plex with better hardware, assuming of course there is a Plex Docker inside Hass.io.
 
I just run my HA setup (With Node Red) in a VM on a Win 7 box. Zero issues.
 
To get rid of the corrupt SD card headache, wouldn't someting like this work ?

 
I just run my HA setup (With Node Red) in a VM on a Win 7 box. Zero issues.

You just used a swear word called Windows.

I could run it in a VM too on my UnRAID box but the idea here is to have a super light on power solution so that I can power down the UnRAID server when the need arises and keep everything else online.
 
Interesting I found that HA themselves are hosting the Supervisor in Docker and this is actually available on the UnRAID store.


Says for testing purposes so maybe they have some plans.

Means I can at least install it and fiddle with it without buying anything.
 
You just used a swear word called Windows.

I could run it in a VM too on my UnRAID box but the idea here is to have a super light on power solution so that I can power down the UnRAID server when the need arises and keep everything else online.

I hear you; however I run my Plexiglas server off there and some other stuff that just works better on Windows. Its the only machine that has Windows on it. If I could, I would replace it with a Mac mini.
 
I hear you; however I run my Plexiglas server off there and some other stuff that just works better on Windows. Its the only machine that has Windows on it. If I could, I would replace it with a Mac mini.

To be fair use the right tool for the job and what works for you personally.

Windows just never did headless very well in my book and always burned a bit too much in the way of resources for a lite weight gui purpose.

Especially when Windows 10 came along it was just an unnecessary pain to get stuff to load on startup and full screen and so many built for purpose embedded type tools like OpenELEC came along.

And then when I wanted to hide it all away in the garage a completely headless Linux setup is just so much better.

What is Plexiglass?
 
To be fair use the right tool for the job and what works for you personally.

Windows just never did headless very well in my book and always burned a bit too much in the way of resources for a lite weight gui purpose.

Especially when Windows 10 came along it was just an unnecessary pain to get stuff to load on startup and full screen and so many built for purpose embedded type tools like OpenELEC came along.

And then when I wanted to hide it all away in the garage a completely headless Linux setup is just so much better.

What is Plexiglass?

No idea. I meant Plex server.

I tried the Linux route; but I had such a pain getting my HDDs to mount automatically when booting that I just gave up and loaded Windows. In a headless setup its not bad; I seldom need to connect a screen to it to fix an issue.

Maybe I'll reconsider something else in the new year. Moving into a new house before then and want to start over from scratch; networking, PiHole, etc. So might be a good time to reconsider the options for a download, HA, media box.. want an "all-in-one" solution.
 
It seems the correct answer is actually an Intel NUC.

Didn’t know that was a native option.

Might be a good idea actually as I could push more stuff through Plex with better hardware, assuming of course there is a Plex Docker inside Hass.io.
Did an install recently on a NUC for a friend and it runs beautifully. Super quick!
 
To answer my own question.

1. InfluxDB is a secondary copy of only the sensor data and not everything.

However I've since gone about limiting my domains in Recorder just as general cleaning up of things and also with the notion of if you go SD card and you record less then you shouldn't have issues.

Seems that anything "live" in the system is recorded either way, the Recorder is only really there for persistence after a reboot which is just fine for most things.

So I might just try the Pi and SD card regardless and see how it goes.
 
Would a Pi with the DB on a USB stick work? So then no more crazy read/writes to SDcard which should prevent the corruption?
 
So with load shedding getting on my nerves it's a bit problematic to run my Unraid box through out an entire load shed and so I figured maybe it's time to move my Home Assistant Docker over to Hass.io on a Pi and some specific Dockers that are mission critical to go live on that.

My question relates however to everyone complaining about SD cards eventually dying because of read/writes to the DB constantly.

1. I already use InfluxDB so I can pump it into Grafana. Does this mean there are no "local" writes and everything is going there? Does doing this save the SD card or do I need another solution?

2. In the event of Load Shedding and my Unraid box shutting down, taking InfluxDB along with it what happens to Home Assistant? Does it just write nothing during that period? Does it fall over?

3. Does the same crap apply to things like MQTT? It also has a persistence database after all. Or is that low frequency enough not be an issue.

4. Isn't it possible to simply skip the SD part and do something else? I'm sure money is the real problem there so what are cheap options?

*** I have never even fiddled with a Pi so I have no clue on the hardware front what can and can't be done or supported.
Unfortunately, at this time, you can't boot a Raspberry Pi 4 off an external drive. But you can force the Raspbian OS to use an external drive for its "root" partition, which holds all of its programs and data. So, in effect, you have a small boot partition on a microSD card but the meat of the entire operating system would still live on your speedy SSD or Flash Drive. A future firmware update will allow the Pi 4 to boot off of external drives, no microSD card required.
 
Top
Sign up to the MyBroadband newsletter
X