Home Assistant - migration

Hi,
I have a Home Assistant OS installed on my Raspberry Pi 4B.
I installed it to an oldish SD card for testing HA a week ago.
Now I have bought a new fast micro SD card.
Over the last week HA has gathered a lot of data from my gas boiler.
Is it possible to install (or clone?) HA to the new card and copy all the data from my olmicro SD card? It is not only about gas boiler data but also about various devics that have been recognized by HA.
Thanks.

Hi Robert, welcome to the forum!

Have you searched for backup/restore here on the forum?

You can always backup your installation and after copying it to the new SD card restore it.

Just on a side note: if you want to move forward with your HA installation and automating your home, it is always a good idea to use an SSD, not SD cards. :slight_smile: It is nothing that is necessary in any way, but it is strongly advised to use one. So think about getting one in the near future. :wink:

1 Like

Good advice above: You should attach an SSD.

That said, to get you up and running quickly, you can use the Linux command line tool dd to make a byte for byte clone.

Thanks.
Do you mean that HA OS should be running on SSD disk rather than SD card on my RPi?
Or would SSD be just for data?
Is it about speed?

Mainly for reliability but added advantage will be speed.

Yep, what Nick4 said, mainly for reliability. SD cards are known for very strange errors, if they wear out. And with the amount of data HA is writing to the card, wear out is coming rather sooner than later.

If you ask me, I wouldn’t change it right away, but I would keep my eyes wide open for an offer that is coming around in the next months. To give you an idea, my first SD card with HA wore out after a year, the second (with a bigger installation, more devices, and so on) showed the first signs after only six months. And the money is well spent, you will invest so much in this “hobby” in the next months, the SSD card will be one of the really good investments. :slight_smile:

1 Like

In the case of Raspberry Pi, I understand we are talking about a USB-type SSD disk.
Such as this one:

Either a USB-SSD as you linked to, or you can use an external case where you put in a “normal” SSD. or there are adapters available, where you have barely more than a cable and the SSD is visible and just lying around. Whatever suits you, as long as it is USB3.0 or higher.

I’m probably going to regret saying this, but my SD card has been running happily in my RPi for over three years now.

I keep my database small and writes to a minimum by excluding everything I don’t need to keep from Recorder. I use the backup function only when I’m about to make a significant change. Routine backups are done by copying files off the SD card, not by writing a new backup file every time. This may change if the new ability to backup directly to a remote share works out well.

My RPi also lives behind a small UPS which gives it a decent run time if there’s a power outage. An SSD would reduce that run time while increasing complexity. It is on my list of things to do one of these days, but it’s not high on the list quite yet.

I’m only writing as a counterpoint to some of the above. If you need or want to, I totally agree with going with an SSD. But I wouldn’t dismiss the SD card option out of hand.

I will say make sure you at least follow the documented recommendations for the type of SD card to use. I suspect some of the problems others have encountered are due to using whatever card they had lying around, along with not paying attention to database and backup file sizes.

1 Like

Hi Tom, you don’t have to regret saying this at all and since your a code-addict :wink: (careful readers) we are very gentle with you.

Every joke aside: you are right and you also know very well that there are a lot of cases of corrupt SD-cards and of course you can influence that by not writing everything to it, buying high grade cards and minimize/avoid improper shutdowns.

Of course there’s the benefit of power usage/$$$/no extra clutter but also the downside with a SSD of new issues because of a power adapter not being up to the increased power draw.

Does HA on RPi make it possible to write data to a local file server (WD Red Plus HDD) instead of SD card?
That would minmize writes and save the card.
But perhaps HDD does not make sense here, as opposed to SSD?

That might be slow, depending on some factors like the power of the NAS, how it’s connected, the protocol used, etc. Personally I wouldn’t do this, but it is necessary for making backups.

I actually had similar thoughts this morning. To add: Bdraco has been making massive improvements to the database over the past year or so. The per second updates aren’t the norm anymore. I think the default commit period is now 5 seconds, but you can change that. Plus, numerous other changes. I think an SD will last a lot longer now, and HA’s own devices ship with an SD. You can buy very high quality SDs. Most people buy the cheap stuff which will fail sooner. I too used this, but already years ago, where each of two SDs (of good quality) failed after about a year. Now I’m on an SSD.

1 Like

Update one year later, on the main topic (which is the first result on Google for me): nowadays HA allows you to restore a backup file directly from the fresh install. Just create a full backup from Settings > System > Backups, download it to your machine, setup your new microSD as usual, and once it finishes the initial setup, choose to Restore from backup:

image

1 Like