Samba Backup: Create and store backups on a Samba share

Since a couple of days after upgrade HA to 2023.10.1 my backup fails.
Log shows
[23-10-08 00:00:16] INFO: Backup running …
[23-10-08 00:00:18] INFO: Creating backup “Samba Backup 2023-10-08 00:00”
parse error: Invalid numeric literal at line 1, column 5
[23-10-08 03:00:30] INFO: Backup finished
Notification report Backup failed

A question about how I can build my own add-on

  1. what role does build.sh have and when is it called?

Is there a way to have more than one setup? I want to backup to two different shares.

Hi, I’ve just stumpled upon this hostname problem, as I reconfigured my home network, some IPs have changed, and the backup was broken.
So I decided to make my config resilient, chenged the old IP address of my backup host to the mDNS hostname which is easily resolved by all other tool I use.
The backup was working for a few days, but suddenly broken again saying:

[23-11-18 03:24:09] WARNING: do_connect: Connection to homeserver.local failed (Error NT_STATUS_UNSUCCESSFUL)
[23-11-18 03:24:09] WARNING: Could not copy backup e61dd386 to share. Trying again ...

This is confusing as the documentation states:

Option: host The hostname/URL of the Samba share.

The smb share is hosted on macOS.

If the dns cant be reached just use the ip address and make it static in your network so it would be always reachable.
The hostname not always work due to complexity of network/router/other stuff

Yeah, I did that for the Samba Backup add-on stability reasons, but please note that I use the mDNS names in other HA integrations and they always resolve this hostname, just this add-on stops working after a few days.

Well mine didnt even work because I cant understand what kind of folders does it need. I created custom folder with a custom user but I cannot access em (Im using synology).
Open an issue on the github page, maybe you get more attention from the dev

Hi,

even though everyone seems to tell it works, this addon does not delete backups on my HA for me.

I have keep local backups on 2 and keep remote backups on 8 and 2 backups each week. But actually never(!!) has samba backup deleted any backup.

What is wrong. Anybody who can help?

Thanks,
Robert

HA: 2023.11.2
Samba Backup: 5.2.0
I can’t share any logs. When I go to the logs tab and refresh, the page remains empty!

I’ve also noticed if keep_local and keep_remote have different numbers it doesn’t work properly. If they have the same number then it is correct.

Currently keep_local is set to 1 and keep_remote is set to 5.
There is 1 on the share and 5 local !?

Hmm, this works to perfection for me. Even in two different environments. One is a on a docker on a Windows machine backing up to a local NAS. The others are 3 HAOS on an Intel NUC I3 backing up to a remote NAS with the services of ZEROTIER. All works perfectly. I just counted and the number of local backups and remote backups all match on all four instances.

My .samba_backup.sensor shows;

  "state": "IDLE",
  "attributes": {
    "friendly_name": "Samba Backup",
    "backups_local": "1",
    "backups_remote": "1",
    "total_backups_succeeded": "132",
    "total_backups_failed": "4",
    "last_backup": "2023-12-23 01:33"

while today local has 2 (22/Dec & 23/Dec) and remote has 1 (23/Dec)

and the log

[23-12-21 09:43:25] INFO: ---------------------------------------------------
[23-12-21 09:43:25] INFO: Host/Share: 172.16.10.170/homes
[23-12-21 09:43:25] INFO: Target directory: HASSio
[23-12-21 09:43:25] INFO: Keep local/remote: 1/5
[23-12-21 09:43:25] INFO: Trigger time: 01:30
[23-12-21 09:43:25] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[23-12-21 09:43:25] INFO: ---------------------------------------------------
[23-12-21 09:43:28] INFO: Samba Backup started successfully
[23-12-22 01:30:42] INFO: Backup running ...
[23-12-22 01:30:43] INFO: Creating backup "Samba Backup 2023-12-22 01:30"
[23-12-22 01:32:47] INFO: Copying backup 8f3bbec7 (Samba_Backup_2023_12_22_01_30.tar) to share
[23-12-22 01:33:22] INFO: Deleting 3c6d4ef0 (Samba Backup 2023-12-21 01:30) local
[23-12-22 01:33:23] INFO: Deleting 9299d7dc (Samba Backup 2023-12-20 01:30) local
[23-12-22 01:33:23] INFO: Deleting 4b2778b9 (Samba Backup 2023-12-19 01:30) local
[23-12-22 01:33:23] INFO: Deleting 31c82e50 (Samba Backup 2023-12-18 01:30) local
[23-12-22 01:33:24] INFO: Deleting 5959004f (Samba Backup 2023-12-17 01:30) local
[23-12-22 01:33:35] INFO: Backup finished
[23-12-23 01:30:54] INFO: Backup running ...
[23-12-23 01:30:55] INFO: Creating backup "Samba Backup 2023-12-23 01:30"
[23-12-23 01:33:11] INFO: Copying backup 722aff84 (Samba_Backup_2023_12_23_01_30.tar) to share
[23-12-23 01:33:52] INFO: Deleting 8f3bbec7 (Samba Backup 2023-12-22 01:30) local
[23-12-23 01:33:52] INFO: Deleting 3c6d4ef0 (Samba Backup 2023-12-21 01:30) local
[23-12-23 01:33:53] INFO: Deleting 9299d7dc (Samba Backup 2023-12-20 01:30) local
[23-12-23 01:33:53] INFO: Deleting 4b2778b9 (Samba Backup 2023-12-19 01:30) local
[23-12-23 01:34:05] INFO: Backup finished

Samba backup deletes when it is ran, so when is it scheduled to run next? As you install and update items you make backups (if you select to do so), then when Samba Backup runs, it sets the number of backups to your settings. Check the number of backups directly after Samba Backup runs.

I tried that as well and did set both to 8. But it made no change. Still backups don’t get deleted.

But now I can see the log however. And as it died during copying it propably did no deletions:

[24-01-08 01:00:37] INFO: Backup running ...
[24-01-08 01:00:37] INFO: Creating backup "Full Backup 2023.12.4 2024-01-08 01:00"
[24-01-08 01:07:21] INFO: Copying backup 955ebe31 (Samba_Backup_Full_Backup_2023_12_4_2024_01_08_01_00.tar) to share
[24-01-08 01:07:21] WARNING: 955ebe31.tar does not exist
[24-01-08 01:07:21] WARNING: Could not copy backup 955ebe31 to share. Trying again ...
[24-01-08 01:07:27] WARNING: 955ebe31.tar does not exist
[24-01-08 01:07:38] INFO: Backup finished

However, that 955ebe31.tar file is on the SMB share. And all that confusion gets clarified as this SMB share was added to HA as an additional storage to be used for backups a long while ago. I will now disable that storage in the HA storage config and only put it into the Samba Backup config. Lets see how it goes …

1 Like

Is there a way to add directory to the list of directories being shared that is setup by the samba backup add-on?

I have a production HA and a test HA. I use the samba backup add-on to create production backup and store the backup on the test server. Because there is a limited number of shares available I created a sub directory under backup in the test HA to store the production backup. I would like to use a separate share to store the backups in.

Very well … my issue is resolved. After no longer co-using the smb share for samba backup and the HA integrated storage settings (to put backups on this storage) it all works perfectly.

Thanks.

sorry, my fault

Ran into this myself like the others after switching the default backup location to the same Samba share that the addon uses. Apparently this trips the addon as it expects the backup slug to be created in the local HA disk.

I have the same bug.
Couldn’t copy backup ‘slug ID’ (‘backupname’) on the network share.
Without use Samb Backup, i tried to make a manual backup (partial or complete), and the filename of the backup are keeping the slug name instead of the backup name…
Same on the local disk for HA… Not linked with samba backup

Interesting that you are seeing this in absence of the addon. Meaning that apparently the problem is on HA itself. What you describe is exactly what I saw.

Yes the problem is on HA itself…
Seams from 2023 September updates…