Home Assistant backup retention

Hey there,

I again ran into a full backup storage and as my „backup backup solution“ (backup HA vm in proxmox) also failed unrecognized for quite a while and I recently destroyed my instance I just lost data and configurations of multiple weeks :weary:

Is there any known possibility or workaround for creating a backup retention policy in Home Assistant for example via an automation?
I imagine something like keeping the last two weeks of backups + 1 of each month for the last 12 months.

I only found this feature request from 2022 which doesn‘t seem to be very popular though:

How do you guys solve this?

Thank you and best regards
Micky

The samba backup add-on backs up to another device, retaining the last x backups on HA. I backup to my NAS and keep them all, with only the last 10 on HA itself.

1 Like

Yes, this would be my solution too. I do the same, I keep 1 original and 10 days of backups. But the deleting the backups are manual. I’m sure I can write a script for my NAS to delete older backups.

1 Like

I use the same addon and it automatically deletes old backups on the remote share. Are you sure you have configured it correctly?

[23-10-01 12:26:00] INFO: Samba Backup started successfully
[23-10-02 10:51:10] INFO: Backup running ...
[23-10-02 10:51:10] INFO: Creating backup "Samba Backup 2023-10-02 10:51"
[23-10-02 11:04:06] INFO: Copying backup 3802cf3f (Samba_Backup_2023_10_02_10_51.tar) to share
[23-10-02 11:04:16] INFO: Deleting d9472d0a (Samba Backup 2023-09-27 10:51) local
[23-10-02 11:04:16] INFO: Deleting Samba_Backup_2023_09_22_10_51.tar on share
[23-10-02 11:04:27] INFO: Backup finished
1 Like

Thanks guys for the replies, indeed I already used to use this addon too but seem to have missed the retention functionality. I will have a try and report again! :grinning:

Now that we have the option to save HA backups to an SMB share, the only feature missing from HA is the backup retention, compared to Samba Backup. Anybody got solutions for that?

1 Like

@TurfFiber check my repo GitHub - zamolxe/homeassistant-aswt.
I’m doing automated backups on an NFS share, and have a script that does the cleanup using the ha backup cli.

The script is looking good, although switching from Samba Backup to another unofficially supported script would be the equivalent of pushing the same rock uphill, if you get what I’m saying.

You don’t need to change anything on your end. The cleanup one is using native “ha backup” commands, so doesn’t matter where you store it, as long as HA knows about it, it will work.

The only thing you need to do is install the aswt, and setup just the cleanup… see the examples in the repo readme.