The Raspberry Pi is quite possibly the most popular device to run Home Assistant on. It’s small, relatively cheap, and won’t make a noticeable dent in your electricity bill. But, the Raspberry Pi has one pitfall: It uses microSD cards for storage and microSD cards aren’t very reliable at the best of times. This issue only gets exacerbated when they’re constantly being written to. Unfortunately, that is exactly what Home Assistant does.
While there are ways of using external SSDs, they can be quite complicated to set up. And despite all the downsides of using microSD cards, I still recommend them for absolute beginners who are only getting their feet wet. Once you’re well into the project and haven’t given up on Home Assistant, you can start to think about other storage solutions.
So, what is one to do in this situation? My recommendation is to choose the most suitable microSD card for a Raspberry Pi running Home Assistant to begin with. If your cheap microSD card bought from a dodgy store fails within a few weeks you will quickly become disheartened and might give up on getting to know Home Assistant. By choosing the right microSD card for the job, your setup should survive for longer. Even if the recommended cards cost more than the alternatives they will save you money over time simply by not dying.
microSD card failure prevention
There are ways of limiting the amount of data your Home Assistant writes to your microSD card. Limiting those writes is the easiest way of extending the lifetime of your microSD card. The most frequent writes come from the recorder, which stores details from all of your sensors and switches etc. in Home Assistant’s database.
It is recommended to set the commit_interval of Home Assistant’s recorder to a higher value (at least 30 seconds) when using a microSD card. Making that one adjustment should extend your microSD card’s lifetime considerably.
Any microSD will most likely fail at some point. I won’t be recommending any indestructible microSD cards, simply because they don’t exist. Were your microSD to fail, you wouldn’t want to start configuring your Home Assistant from scratch. The easiest way of assuring you don’t have to do so, is by making sure you frequently back up your Home Assistant configuration.
There are multiple ways of backing up Home Assistant, and you can even have your backups automatically uploaded to Google Drive and other cloud storage providers. Setting up an automated backup task should be one of the first things you do, right after installing Home Assistant on your Raspberry Pi. It is never too early to start backing up your Home Assistant configuration.
Avoid these microSD cards
Whatever you do, do never buy a microSD card for Home Assistant from an unreliable source. Buying microSD cards from a Chinese store you never heard of might be cheaper, but you have no way of knowing their legitimacy until you have them in your hands. Even then, some counterfeits are almost impossible to identify as such. To add to that, selling fake microSD cards, which will report a larger storage capacity than they actually have, is a common scam.
Additionally, when buying microSD cards from an untrustworthy source you will probably also have issues when it comes to replacing the card under warranty. Save yourself the headache and only go with well-known and recommended brands.
The best microSD cards for Home Assistant
The Home Assistant developers recommend you go with an Application Class 2 rated microSD card. While that is certainly good advice I’m going to take it one step further and recommend you buy an endurance microSD card. Endurance microSD cards are built to be used in dashcams and security cameras. Just like Home Assistant does when running on a Raspberry Pi, those cameras are continuously writing to the microSD card.
When it comes to size I’d go with at least a 32 GB microSD card. However, that is the absolute minimum I can recommend. If your budget allows it, go with a 128 GB or larger card to future-proof your setup. Below you will find a list of the best microSD cards for Home Assistant. The endurance numbers are for the 128 GB version of each microSD card.
SanDisk MAX Endurance and Samsung PRO Endurance
The most impressively specced microSD cards rated for endurance are produced by SanDisk and Samsung. This should come as no surprise as SanDisk (who was bought up by Wester Digital some years ago) and Samsung are two of the largest manufacturers of NAND flash memory. As such, they get to keep the best chips for themselves.
The SanDisk MAX Endurance beats the Samsung PRO Endurance in terms of write speed, overall endurance, and warranty.
Cheaper microSD cards for Home Assistant
If the options above are too pricey for your liking, you will find a handful of cheaper endurance cards from multiple manufacturers. These will obviously not last as long as the more expensive options and have a shorter warranty.