Migrating from Raspberry Pi 3 to Pi 4

Fixt it. After refreshing page the snapshot was shown. :pleading_face:

1 Like

What’s the best way to restore in this case: “restore selected” or “wipe and restore”?

I always use “restore selected”. In both cases, probably your home-assistant_v2.db will be corrupted and you will need to delete it before restarting HA.

Hm, on selecting “restore selected” connection is lost and HA seems to restarts. Do I have to delete .db before selecting “restore selected”?

No, after restart you delete it and restart again.

1 Like

I am moving my hassio install from a pi3 to a pi4. I’ve read through and found lots of helpful info, especially wrt stopping addons before taking a snapshot. However since I use influxdb, there is one more caveat for those moving from a 3 to a 4… the influxdb addon is not cross compatible. After restoring my snapshot based on the pi3 image, with the influxdb addon included, the pi4 would not start influxdb. The supervisor page for the addon acted weird too (showing the addon as installed, but doing nothing when trying to start it). Trying to start influx this way, logs indicated no addon was installed. So I had to uninstall the addon and reinstall it on the pi4… then after configuring everything works.

So folks moving from a pi3 to a pi4 will have to leave out the influxdb from their snapshots, and install influxdb from scratch on the pi4.

3 Likes

When doing the restore from a HA backup, there are several parts of the installation that can be selected separately.
I have best luck using the Restore Selected and only restore Folders and Add-ons. I find if you restore the actual Home Assistant version, it will restore the Pi3 (or whatever you were on before) version of HA.

Also, make sure your old install (the Pi3 or whatever you are migrating from) is on the same version as the version in the Pi4 and that all addons are updated to the latest versions also before backing up. This means if you had 32bit 0.108.1 version on old install, make sure the new one is also 32bit 0.108.1.

Edit: You could also do a partial backup and only backup the folders (which includes configs) and add-ons and then restore that to the new system.
Just as a note, some plugins/addons don’t migrate nicely (someone did mention influxdb) so these may need to be unselected for restore.

2 Likes

Good thing you mentioned being on the same HA version. Thank goodness older versions are always available to do this with. Hopefully anyone messing with 64bit knows what they’re doing, but I think 98% of folks don’t need to worry about the 64bit vs 32bit thing (32bit is recommended even on pi4).

As far as restoring a partial snapshot done on a pi3 to a fresh pi4 install, it worked for me without issues. There’s no option there to restore hassos (which is the part that’s different from pi3 to pi4, not ha or it’s addons), but maybe that could become an issue if a full snapshot is used?

Also for hassos users, not sure if the hassos versions have to match as well, but anytime I’ve done a full system restore it has been on hassos that matches the snapshot version.

Regarding database snapshots, I have found them too buggy to rely on so I just leave them out of my snapshots. However I’ve read some folks having success here and there when they first disable the offending db addons before taking a snapshot. I did that and it didn’t work for me, but ymmv according to others.

@G8YTZ my questing too, this lockdown has made me decide to reinstate my NUC as a games machine so i have a RPi 4 coming

Only issue is trying too get the fan to run on the PoE module on the 64 bit version of HASS so I’m still running the NUC for now. It is easy to migrate, create a snapshot on the old machine, install the new machine from scratch, add the Samba Share extension and plonk the old snapshot there and restore. Worked like a dream oh and you’ll have to swap the ip addresses over too to make things simple.

Is the Deconz paired lights included in a snapshot, or do they need to be re-paired after migration?

hi all

Quick sanity check on the steps above (setup, taking snapshot, restore, etc) are also relevant if going from RPi 2 up to a RPi 4?? (based on the comments it would be a noticeable upgrade?)

Brendan - Thanks for the note mate.

Folks - I had the same issue when trying to migrate from HA on the Raspberry Pi 3 to Raspberry Pi 4. Initially i just selected all the components while restoring i.e. Home Assistant, Folders, Addons. This totally buggered the restore. So just to be clear i was trying to move from a 32 bit OS on the Pi 3 to a 32 bit OS on the Pi 4. Key is to make sure that both HA on Pi 3 has been updated and is at the same version as HA on the Pi 4.

I then retried the restoring only the following components i.e. Folders, Add-ons and it came up cleanly…almost i.e. I had some bad DB errors (i had migrated from SQL lite DB to MariaDB on my older Raspberry Pi 3). I just disabled the MariaDB / recorder configuration and forced the HA to rebuild it’s DB on the Raspberry Pi 4 using SQLite again. It worked like a charm, rebooted and everything was ok.

I still have issues with my Aeotec Zwave stick not being recognized on the Pi 4 but that’s another @#@#[email protected]#$ issue.

Thought i would come back and give you guys an update. It should also help others down the line.

So I have done maybe a dozen restores over the years. I have found that restoring (and making) a snapshot takes way longer than you think and it’s easy to think it’s locked up or unresponsive as there is no % bar to show progress and I am certain a lot of people who report failures just are too impatient and restart Home Assistant in the middle and then complain there is errors or missing stuff in the backup. Even on my NUC it can take almost 40 mins to make a backup depending on the database size and longer to restore.

I set my snapshots to be automatically made at 3am (I think now since the purge takes place at 4:12 for the dB… something like that) so if I open the snapshot and examine it’s contents (multiple zip files) I can see that all components are definitely in the snapshot. When I restore I just go away for an hour and wait till HA restarts itself which it does when the restore is finished.

Needing to delete the database is common issue when you restore a snapshot. I too am now using a mariadb and there is a purge command you can run to delete everything out and in 0.112 you can now even repack a mariadb which is probably a good idea.

1 Like

Thanks David. Much appreciated.

I’ve noted similar behavior with the snapshots, have scheduled daily ones for 0100 and a backup to Google Drive at 0300 using the Google Hassio automated backup plugin.

Sorry, not entirely clear about the DB part. Are you suggesting that once i have restored snapshot onto the Pi 4 I should be able to purge MariaDB and force HA to rebuild? In my test setup i ended up just rolling back configuration and forcing Pi 4 to go back to SQLite.

Also what do you mean by re-pack a MariaDB. Sorry, played around with DB’s a bit but never heard of repack.

Am back to using my Pi 3 since the Aeotec Gen 5 isn’t detected on the Pi 4. Total bummer…tried one of the officeworks (older) USB 2 hubs but it still won’t detect the darn Aeotec. Not sure what sort of a USB 2.0 hub is required to get the Pi to detect the Aeotec.

Thanks a ton mate. Much appreciated.

Yes when system is restored you still should be able to use the purge service. Or worst case configure for SQLite and remove the addon, restart and add it again. If that still shows the old data then you should be able to find the persistent storage by navigating up a level in ssh - it SHOULD delete the data when you delete the addon though.
There is a new option in 0.112 whereby when you purge the dB you can also repack it which essentially rewrites to a new database and deletes the old one. I got back a few GB yesterday running that option. The repack is an option for SQLite dB - it removes empty space but now you can do that too with mariadb. Previously there was no way to reclaim blank unused space.

Nice one David. I’ll have to try out.

Thanks a ton mate.

Cheers,
Trevor

1 Like

I’m thinking to migrate from Pi 3 to Pi 4 too. But my Pi 3 hassio is still running 0.104.3 while the latest is 0.113. Will that be an issue when i restoring the snapshots in Pi 4 if i just select Folders and Addons?

I feel bit skeptical to upgrade the Pi 3 because i afraid it will break something before my Pi 4 is up and running.

You can follow the normal process and then downgrade to your version prior to restoring the backup.