Rpi sd card reliability

SanDisk Extreme Pro 32GB card here. Been running Home Assistant on an RPi 3 with this card for over 1.5 years now. I have a fairly extensive config and keep a 7 day database with MariaDB. No corruption issues. Be selective with your logging.

I did crap out a couple of cheapo cards way back in the day.

2 Likes

I have exactly the same configuration. 7 days recording, the size of the database is 80MB. Works since 1.5 years now.

1 Like

How are you doint the 7 day limit and where can i set logging levels? Some settings, or configs?

Through the recorder integration.

1 Like

Thx man for info!

There’s a thread on writing log files to a NAS rather than the SD card here. Reduces SD read/write activity significantly and prolongs the life of the card.

you mean all logs, even state history?
Or just system logs in Conf->logs

The file home-assistant.log remains on the SD card in the config folder (but very small - only 119kb on my system at present). The rest goes to a database on the NAS (currently 0.3gb).

So if network is down (router restart), your HA is dead in the water?

Isn’t it anyway? :grin:

i think no :slight_smile:
because the HA is the master all other stuff is slaves.
i might think the HA may go crazy that there is no DB, trying to create etc.
I might be wrong…
Somebody with exp might give some word

No, it will continue to work, you’ll get some error message about recorder, history, etc. not working, and you can of course not look at the history of an entity or similar things related to the DB, but HA runs fine. HA doesn’t need the database to operate, I had a HA instance running for testing for 6 months without any DB at all.

i see , noice! thx for update

So you are saying that all the triggers and automations worked, but without the history? correct?

It depebds, if your automation relies on historical data it won’t work, otherwise they run fine. Why shouldn’t they? When you have an automation that triggers on motion, why should it depend on history? This would be really bad design.

yeah agree

I have the same problem with 2 SD cards giving up. It’s probably due to how frequently home assistant (HA ) writes to the SD. I am not a database person so can someone share how they setup HA to use an external database for recorder integration? I have seen the documentation on it and read up some other links etc but haven’t had much luck. I would like to use mysql database on a Windows machine running on the same network. If possible, try to get HA to write all the logs, and history information to this separate machine and database. Any help would be appreciated

You point HA to your database in the recorder configuration.

This is my recorder config. My db is obviously not on a separate machine but the only thing that will change is the url that points to the db, which will depend on the db you are using.

recorder:
  db_url: mysql://homeassistant:XXXXXXXXX@core-mariadb/homeassistant?charset=utf8
  purge_keep_days: 7

include:
  domains:
    - alarm_control_panel
    - person

    etc. etc.

A better question is how many entities are you recording the history for? If you don’t need the history for an entity to include in the logbook or history graph or future reference by a sensor or template or something they why are you recording it? Do you really need to know what the sun elevation was at 3:15 pm 11 days ago?

If you have an entity that is changing state every second and the history for that entity is on then the database is making an entry every second (not considering any db write caching).

If you have the processing power and storage space to record everything then go for it but on an an RPi and an SD card with anything but the most basic configuration, you need to be selective in what history you record for both system performance and SD card reliability. You also need a fast high quality SD card.

1 Like

Thanks I have the recorder working with external MySQL database on a separate windows machine. Appreciate the info. I also found this link quite helpful for anyone else needing a reference.

1 Like

Thank you for sharing the link, really easy.