All historical data data lost after lower outrage

Today i had a power outage and now I have lost all the historical data in HA.
That is really, really annoying and it is not the first time I lost all my data.
Is there a way to recover this data in HA?
Is there a way to backup all this data?

If you are making regular backups the data will all be in there.

The backup is a compressed archive. Open it up with 7zip or similar and look for the file home-assistant_v2.db.

Stop home assistant, copy this file to your /config directory and restart home assistant.

Alternatively if you search the forum you will find topics on database repair.

Thanks for the answer.
is that also the case when I use MariaDB?

No. You will have to restore the backup of the MariaDB add-on instead. You can do a partial restore if all you have is a full backup.

ok thanks. How do I only restore the MariaDB add-on?
I can’t find the file location on the disk.

You don’t do this by copying a file. Use the partial backup restore process.

I don’t have a backup of MariaDB I added it recently.
It is possible to do I a partial restore of the HA history data from a full backup. Or do I have to do a full restore to get the history back from the last backup?

I don’t have the impression I have a lot of control of HA history data.

It’s quite a while since I’ve done this but yes I’m pretty sure you can,