When I first started to properly explore Home Assistant with a view to moving to that, from openHAB, as the Home Automation ‘hub’, I wasn’t certain things would work out so I decided to host it on a Raspberry Pi 4 that I could re-purpose if required. I was aware the lifetime of the Pi’s Micro SD card storage would be limited, having had issues with SD cards wearing out when hosting databases previously, but I left that as a problem for my future self.
About 15 months later it looks like the SD card has worn out. While Home Assistant’s control functionality is still working, Backups are failing and History data and graphs are missing. There are errors in Settings > System > Log like: Unrecoverable sqlite3 database corruption detected: (sqlite3.DatabaseError) database disk image is malformed
Now I’m settled on using Home Assistant, one option would be to host it on a more robust platform. (For example, I used to run openHAB in a Docker Container on an HP MicroServer.) For now though, I’m going to keep it on the Raspberry Pi 4 – albeit with a couple of improvements to the storage set-up:
- I’m going to use a SanDisk “High Endurance” Micro SD card in the hope that will last longer
- I’m going to use an External Data Disk – a separate USB 3.0 Flash Drive – to move the write-heavy transactions onto that other drive, which should cope a bit better (and possibly perform better too)
- A proper USB-connected SSD would be ideal but would need more power which could be an issue for the PoE-powered Pi 4 – and I’d prefer to keep using PoE so the power comes via the UPS
I downloaded the last successful automated backup. I did try Restoring to that but it didn’t work, tending to confirm the theory of the SD card being the issue.
Installing HAOS on the new SD card then booting with that and importing the good backup when first prompted with the option to do that worked fine.
We’ll see how long the new SD-card-and-USB-storage combination lasts this time. I do like the principle of running Home Assistant on a standalone machine – and I like the built-in “App” feature that comes with that – so as long as it lasts for a few years I’ll probably stick with the standalone configuration.