Old backups not getting deleted from disk

I’ve set up the new automatic backup creation to the local device and configured retention to save 3 old backups. After a new backup is created, as expected the “My backups” interface in HA only shows 3 automatic backups:

However(!), if I look at what’s actually in the /backup directory on the device’s disk, the oldest automatic backup which no longer appears in the above screen is still actually there on the disk:

I don’t know if this is some kind of permissions issue or related to my hardware or what.

I’m running HA via HAOS on an odroid-n2.

It looks like the previous backups were done with earlier HA versions, maybe even before the automatic backup option. Definitely maybe.

In your shoes I’d delete the non-current backups (unless there’s a reason not to), and then monitor the backups moving forward.

Thanks, there are old backups from previous versions in the /backup directory, but the one I indicated in my screenshots which disappeared from the HA web interface but still exists on the disk is a “new” backup system backup that definitely should have been automatically deleted from the disk (presumably when it was removed from whatever index that HA maintains to show the list of existing backups in the web interface).

Hello pjv,
Is it still there after you restart Home Assistant? Thinking maybe some Caching issue is showing up.

Good question. I restarted HA and yes, the old backup is still there on disk (and still not there in the web backup interface).

I wondered something similar, like maybe the actual deletion of the file is asynchronous and managed by a cron job or something. It’s been sitting there for almost 24 hours at this point, but I guess it could easily enough be a weekly thing.

i’ll let it sit there for a while and see if it goes away by itself, but if anyone knows how the retention stuff in the new backup system is actually implemented and can weigh in on whether lingering files is expected or not, it would be appreciated.

I checked on 2 HA instances, in both cases the expected number of automatic backups is there, and not more.

1 Like

Thanks for the data. Can you confirm the owner and permissions on the files on disk? Are they owned by root and 644 like in my screenshot?

The non automatic backups (short named tars) are from the Google Drive backup add-on.

1 Like

@francisp Thanks again. Looks like my system is acting funny. I’ll let it sit until after the next scheduled automatic backup this weekend and see what happens.

When the scheduled automatic backup ran last night, the old backups were automatically pruned from the disk, so this is apparently not an issue in the case where the only backups are scheduled automated backups.

1 Like