Migrating database to new host

Hello, I’m currently trying to migrate from ARM (Pi3) to x86/64.
I performed a full backup, and after a multiple hour long import, my new host has the old configuration.
However, the database is truncated to the time I performed the import (no old records have been kept)

Is this by design? And if so, is there a simple way to forklift the database over too?
Can I just copy the DB file over?
Failing that, could I externalize the DB, and point the new HASS instance at it?

Thanks :slight_smile:

Stop the home assistant service first.

ha core stop

Then try copying the database file over and start it up again:

ha core start

I don’t think the database should have been truncated.
You are using the internal one or an addon based like MariaDB?

Usually a backup includes the database. So maybe something went wrong during import. So it might be as easy as stopping HA (as described by @tom_l ) and then copying the db file from your backup.

Maybe on a side not: you need SSH when you stop HA core because the webUI will not work anymore.

I’m currently using the internal database.
It is 10GB large, so I’m wondering it that might have caused part of it to fail on import.

If I can get SSH working on both, I’ll have a go at transferring it with something like scp. Or possibly dumping to a network share. Thanks.

If it is available try ‘rsync’ it is what admins use to copy directory structures. It was designed for this task and overcomes many shortcomings of ‘scp’. NOT available on HAOS.

It’s funny, my first thought was rsync too, and indeed, it wasn’t there!

The good news is, I’m all up and running, and the transfer went fine. Thankyou to everyone who assisted :slight_smile:

I’ll jot down here in case someone happens to find this thread in the future what the procedure needed was:

My experience migrating from Rpi3 to Proxmox qemu VM, with a slightly large DB:

Full backup on Rpi3. (I did this to a network share, as backup download wasn’t working)
Upload backup to VM from initial screen (Nothing seemed to happen/update after I confirmed restore, so…)
Open the HASS cli from Proxmox (Console on the VM)
Run ‘backup’ to find the name of the backup
Run ‘backup restore <name_of_backup>’
Wait for it to complete (this took a few hours on the first attempt, it was faster when I beefed the CPU/RAM)

Once complete, on both the Pi and the VM install the ssh addon, set a password, and set the port (22 is the traditional one)
SSH into both machines as root, and stop HASS with ‘ha core stop’
(At this point, if you have any USB devices, unplug them from the Pi, plug them into the Proxmox host, pass them through to the VM, and restart VM)

Delete the DB from the VM (or rename it)
SCP the DB from Pi to VM 'scp /root/config/home-assistant_v2.db <VM_IP>:/root/config/home-assistant_v2.db ’ (md5 if you want to be extra fancy)
Start HASS on the VM with ‘ha core start’
Disable the ssh port and plaintext password.
(And double check any USB devices related services are happy, they may need new device paths)

Search for “USB by serial id”. This should never change.