I was about to go through the whole thing with getting my Pi4 to boot off an external SSD drive, but further research landed me on this interesting blog post.
It looks like the recent SanDisk High Endurance sd card uses 3D TLC NAND Flash, much like regular SSD drives on the market, and the latest Max Endurance card uses pMLC NAND Flash which should last even longer. Supposedly the WD Purple sd cards are similar but I don’t know what type of flash is behind it. They all have write leveling, so data writes will spread evenly throughout the entire drive, and the larger the drive, the longer it will last. Which explains why the 128GB version of the Max Endurance drive has a 10year guarantee while the 32GB version has 3 years.
So if you’re building a Home Assistant box through Raspberry Pi, you can probably pick up a 64GB Max Endurance card for $20 and be confident that it will last for a while. (or splurge $30 and get the 128GB version)
Of course this is just info from research, and I’ve only started using the Max Endurance card myself. Time will tell how long this SD card will really last. But given the data, so far I’m convinced, and with daily backups I can rest easy.
I’ve done a lot of searching on this topic, hope this isn’t redundant info. Hope you find this info useful.
Well as I am planning to migrate from VeraEdge to HA and was thinking to buy pi4 with SSD to, this is very interesting. Although external SSD is not that expensive, I prefer internal SD.
A good SD card is essential. But there’s one other thing you need to do to extend the life of the card and avoid HA crashes: Manage the database!
By default, HA stores every event, every state change, and all the energy data in one database. The vast majority of that data is rarely, if ever, needed. Even a modest-size HA implementation will grow the database to multiple Gigabytes in no time, if you take the defaults. You really should tune the HA “Recorder” (thing that manages the database) to store the bare minimum you need.
If you’re buying a Pi4, consider buying the 4GB ram model so you can run SQLite in memory, that will also greatly increase the lifespan of the SD card. Great option after you’ve got everything setup and you won’t be rebooting much.
Just the part of your history of sensor values and state changes that had yet to be written to disk. Not sure how long the commit interval is though…
If you get the pMLC SD card you should be fine unless you have an enormous number of sensors.
I have a TLC SSD hooked up for mine, and it’s total writes for the last year and a half are about 40GB. The SSD is rated to do 200-something TB over 5 years
Once you’re off MMC (and avoiding QLC) you really don’t need to worry about endurance anymore outside of some very write intensive edge cases. Obviously there will be the exception but that’s why we do regular backups anyway and keep our receipts for warranty
Blockquote Once you’re off MMC (and avoiding QLC) you really don’t need to worry about endurance anymore
Good point. I’m not going to bother with storing SQLite in memory now that I’m using the pMLC SD card. It’d be fun to have a reference point for how how it last. Hopefully it’ll take 5+ years for me to report back any failures. (by then I can probably buy a huge SD card that will last forever)
The energy features look like great fun, and I can’t wait to try them out. That said, to me these are advanced features, not designed for beginners with RPi and SD hardware.
Yes, that’s a bold statement. But hear me out. The design decision to stuff all the energy data into the existing database suggests the developers were not running the default database (SQLite) on an SD card. For one thing, the retention requirements for energy data are totally different from those for most other HA entities, yet there’s only one retention value allowed.
The RPi with SD card is presented in the Getting Started documentation as a good beginner platform, but ask any questions about it here and the advanced users and developers scoff. They’re using SSDs and alternative databases.
I’m going even farther out on a limb here and saying (as I have before) that the database design was pretty inefficient to begin with, and adding in the energy data only made it worse. And yes, I spent years as a DBA in real life. I’d be happy to contribute to a project to redesign the database, but I’m not at a point where I can take the lead in that, so I try not to complain. But beginner users are being set up for failure, so I try to warn them whenever the topic comes up. The default database can be managed successfully on an SD card, but it takes some effort.
From memory there was a second retention policy implemented to support long term statistics for the energy components, which was extended to support some other sensor types as well, although I believe it aggregates the data a little to reduce space usage in the long run.
Haven’t actually tried it out myself since I was already storing my energy stats in Influx already and I haven’t figured out bringing those values into HomeAssistant yet, so I could be misinformed/mixing in facts from something else