[Discussion?] Backup via Restic (shell-Script inside)

Hey there… i am new to backups on HAOS.
Since some years i use restic for my backups of nearly everything… my laptop, my servers, at work, etc… i like restic very much for its portablity, deduplication, append-only-backups, etc…

Now i want to use restic also for backup of my HAOS. I was looking on the net for solutions to this… but i only found very old addons, that are faulty or without documentation. So i investigated for myself with my little knowledge about HASSIO / HAOS:

For the shell i found a nice solution… just do uncompresed backups via the given backup-tool and backup the result to my restic repo…

for that, i did this via ssh:

# This installs restic
> apk update && apk install restic

# This generates a full uncompressed backup, uploads it to restic repo and afterwards deletes the local backup-file
> slug=$(ha bk new --uncompressed --homeassistant-exclude-database=false --name $(date +"%Y-%m-%d_%H-%M") --raw-json --no-progress | jq -r '.data.slug') && export RESTIC_PASSWORD='xxxx' && restic -r rest:http://restic-user:[email protected]:8000/restic-user backup /backup/$slug.tar && ha bk rm $slug

Comment:
Uncompressed backups will generate bigger backup-files. But uncompressed backups are necessary for using restics deduplication-feature. Compressed-backups are usually nearly 100% bit-different, which results in nearly no recurring blobs for the deduplication.

For sure, it is a crappy solution to install restic directly via ssh and to use only the shell for commands. But it is a test / start and now i want to go deeper into restic-backups of hassio.

  • What do you think about restic and backups?
  • What hassio-way would you recommend for the backups?
    (Integration/addon/script/automation/etc.)
  • What features do you recommend?
    For example: storing a given number or time-range of local backups and delete only old ones instead of every fresh made-one

i am interested to discuss this with you.

thx in advance

2 Likes

I’m basically new to Home Assistant. I use restic for basically all my other backup tasks, and my offsite restic backups are via SSH, not to one of the cloud providers.

I really want to keep influxdb backed up outside the HAOS system.

I had kind of hoped that the addons would use docker volumes, and that I could just back up the docker volumes, but alas not so it seems.

Also sadly, I don’t see apk installed on the host OS, where I’m running it in virtualization under KVM.