Samba Backup: Create and store backups on a Samba share

After update from version 4.5 to 5, i got a problem with my Samba Backup.

  1. Snapshot not rename as i set on configuration
  2. Snapshot not uploaded to my NAS
  3. Full snapshot that created not fully backup my supervisor addon (missing)
  4. Backup keep local and remote not counted as i set on configuration. Still keep more then i set

Is any configuration settings need to change for this version 5?

Edit: Solved this by changing host: homeassistant to the actual IP of the Samba share.

I’ve been recently having ‘connection refused’ errors. Anyone have any ideas what that would mean? I can access the share through Windows without issues.

[21-09-19 20:10:35] WARNING: do_connect: Connection to homeassistant failed (Error NT_STATUS_CONNECTION_REFUSED)
[21-09-19 20:10:35] FATAL: Cannot access share. Unknown reason.

I haven’t changed my configuration recently and it used to work… maybe some unrelated app could be interfering? I also updated the Terminal & SSH app, and HA itself.

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21-09-19 20:10:34] INFO: ---------------------------------------------------
[21-09-19 20:10:34] INFO: Host/Share: homeassistant/wdgreenhdd
[21-09-19 20:10:34] INFO: Target directory: HA Snapshots
[21-09-19 20:10:34] INFO: Keep local/remote: 10/100
[21-09-19 20:10:34] INFO: Trigger time: 04:00
[21-09-19 20:10:34] INFO: Trigger days: Mon Wed Fri
[21-09-19 20:10:34] INFO: ---------------------------------------------------
[21-09-19 20:10:34] DEBUG: Backups local: 10
[21-09-19 20:10:34] DEBUG: Backups remote: 45
[21-09-19 20:10:34] DEBUG: Total backups succeeded: 45
[21-09-19 20:10:34] DEBUG: Total backups failed: 0
[21-09-19 20:10:34] DEBUG: Last backup: 2021-08-27 04:00
[21-09-19 20:10:35] DEBUG: API Status: 200
[21-09-19 20:10:35] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "IDLE", "attributes": {"friendly_name": "Samba Backup", "backups_local": "10", "backups_remote": "45", "total_backups_succeeded": "45", "total_backups_failed": "0", "last_backup": "2021-08-27 04:00"}, "last_changed": "2021-09-19T19:10:35.136159+00:00", "last_updated": "2021-09-19T19:10:35.136159+00:00", "context": {"id": "f5dba03b76c603c1f842256e6104f4dc", "parent_id": null, "user_id": "497af19d59534462a34ccc4ca9b08cfc"}}
[21-09-19 20:10:35] WARNING: do_connect: Connection to homeassistant failed (Error NT_STATUS_CONNECTION_REFUSED)
[21-09-19 20:10:35] FATAL: Cannot access share. Unknown reason.
[21-09-19 20:10:35] DEBUG: API Status: 200
[21-09-19 20:10:35] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "FAILED", "attributes": {"friendly_name": "Samba Backup", "backups_local": "10", "backups_remote": "45", "total_backups_succeeded": "45", "total_backups_failed": "0", "last_backup": "2021-08-27 04:00"}, "last_changed": "2021-09-19T19:10:35.455807+00:00", "last_updated": "2021-09-19T19:10:35.455807+00:00", "context": {"id": "13dcdaee74357961fdbb23e4a813aeef", "parent_id": null, "user_id": "497af19d59534462a34ccc4ca9b08cfc"}}
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Samba-backup 5.0.0, hassOS 2021.9.7

First time setup (configs and logs below). Triggered a manual run and I see this:

Error occurred! Backup could not be created! Please try again

Which I have, several times. Same message. How do I determine what the error is?

I’m able to use smbclient from a different host to connect to the share with the credentials in the config and create new files/folders, and the log below appears to show show that a samba-tmp123 file was successfully created, so I think I’ve ruled out share permission issues.

host: 192.168.x.y
share: hass-snapshots
target_dir: /
username: ********
password: ********
keep_local: 5
keep_remote: all
trigger_time: '04:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
backup_name: '{type} Backup {version} {date}'
log_level: debug
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21-09-23 00:39:49] INFO: ---------------------------------------------------
[21-09-23 00:39:49] INFO: Host/Share: 192.168.x.y/hass-snapshots
[21-09-23 00:39:49] INFO: Target directory: /
[21-09-23 00:39:49] INFO: Keep local/remote: 5/all
[21-09-23 00:39:49] INFO: Trigger time: 04:00
[21-09-23 00:39:49] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[21-09-23 00:39:49] INFO: ---------------------------------------------------
[21-09-23 00:39:49] DEBUG: Backups local: 11
[21-09-23 00:39:49] DEBUG: Backups remote: 38
[21-09-23 00:39:49] DEBUG: Total backups succeeded: 0
[21-09-23 00:39:49] DEBUG: Total backups failed: 1
[21-09-23 00:39:49] DEBUG: Last backup: never
[21-09-23 00:39:49] DEBUG: API Status: 200
[21-09-23 00:39:49] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "IDLE", "attributes": {"friendly_name": "Samba Backup", "backups_local": "11", "backups_remote": "38", "total_backups_succeeded": "0", "total_backups_failed": "1", "last_backup": "never"}, "last_changed": "2021-09-23T05:39:49.938142+00:00", "last_updated": "2021-09-23T05:39:49.938142+00:00", "context": {"id": "dd3259b90ea139d8b8e4c1f473fdcf3a", "parent_id": null, "user_id": "0f0ce351f9944ff2b00a80031876139b"}}
[21-09-23 00:39:50] DEBUG: 
[21-09-23 00:39:50] DEBUG: putting file samba-tmp123 as \samba-tmp123 (0.0 kb/s) (average 0.0 kb/s)
[21-09-23 00:39:50] INFO: Samba Backup started successfully
[21-09-23 00:39:50] DEBUG: Starting stdin listener ...
[21-09-23 00:39:50] DEBUG: Starting main loop ...
[21-09-23 00:40:18] DEBUG: Input received: "trigger"
[21-09-23 00:40:18] INFO: Backup running ...
[21-09-23 00:40:18] DEBUG: Backups local: 11
[21-09-23 00:40:18] DEBUG: Backups remote: 38
[21-09-23 00:40:18] DEBUG: Total backups succeeded: 0
[21-09-23 00:40:18] DEBUG: Total backups failed: 1
[21-09-23 00:40:18] DEBUG: Last backup: never
[21-09-23 00:40:18] DEBUG: API Status: 200
[21-09-23 00:40:18] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "RUNNING", "attributes": {"friendly_name": "Samba Backup", "backups_local": "11", "backups_remote": "38", "total_backups_succeeded": "0", "total_backups_failed": "1", "last_backup": "never"}, "last_changed": "2021-09-23T05:40:18.888817+00:00", "last_updated": "2021-09-23T05:40:18.888817+00:00", "context": {"id": "494704c6b2dc6ec26b3e53a11532faab", "parent_id": null, "user_id": "0f0ce351f9944ff2b00a80031876139b"}}
[21-09-23 00:40:18] INFO: Creating backup "Full Backup 2021.9.7 2021-09-23 00:40"
[21-09-23 00:40:19] ERROR: Error occurred! Backup could not be created! Please try again
[21-09-23 00:40:19] DEBUG: API Status: 200
[21-09-23 00:40:19] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "FAILED", "attributes": {"friendly_name": "Samba Backup", "backups_local": "12", "backups_remote": "38", "total_backups_succeeded": "0", "total_backups_failed": "2", "last_backup": "never"}, "last_changed": "2021-09-23T05:40:19.441193+00:00", "last_updated": "2021-09-23T05:40:19.441193+00:00", "context": {"id": "c95cd724c520a2c4b6e0528335e2dd79", "parent_id": null, "user_id": "0f0ce351f9944ff2b00a80031876139b"}}

Thanks,
-Jason

I don’t think that this message has something to do with copying the Backup to the share. I think it appears because the backup of Home Assistant could not be created. Do you have enough space on your Home Assistant boot device?
Maybe you try to create a backup directly in supervisor/backups to test if backups can be created.

Space is plentiful and I’d been successfully creating backup files daily with an automation until I switched to Samba_backup. I also looking in home_assistant.log for any backup related error messages and found none.

Having said that my automated backup did run at 4:00am this morning and successfully created a full backup, copied it to the SMB share, and deleted local backups as configured. Appears to run fine automated, just not when triggered manually. I’m fine with this arrangement.

That has nothing to do with whether the backup was triggered manually or time-based. The creation of snapshots itself is delegated to the supervisor - it is exactly the same when you trigger a backup via the supervisor UI without this add-on.
And sometimes the creation fails. I don’t know the exact reason. There are already community posts about failed backups, e.g. Creating a snapshot is not possible right now because the system is in freeze state

Hi there,
I’ve got an Apple Time Capsule and want to save backup there.
I know that it only support SMB version.1, so I’ve already add option:

compatibility_mode: true

but still cannot connect.

This is Configuration:

host: 10.0.x.x
share: Capsule01
target_dir: SOFTWARE/HASS/Backup
username: xxx
password: 'xxx'
keep_local: all
keep_remote: all
trigger_time: '00:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
compatibility_mode: true

This is Log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21-09-29 12:14:20] INFO: ---------------------------------------------------
[21-09-29 12:14:20] INFO: Host/Share: 10.0.x.x/Capsule01
[21-09-29 12:14:20] INFO: Target directory: SOFTWARE/HASS/Backup
[21-09-29 12:14:20] INFO: Keep local/remote: all/all
[21-09-29 12:14:20] INFO: Trigger time: 00:00
[21-09-29 12:14:20] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[21-09-29 12:14:20] INFO: ---------------------------------------------------
[21-09-29 12:14:22] **WARNING: Server does not support EXTENDED_SECURITY  but 'client use spnego = yes' and 'client ntlmv2 auth = yes' is set**
session setup failed: NT_STATUS_ACCESS_DENIED
[21-09-29 12:14:22] FATAL: Cannot access share. Access denied. Please check your share permissions.
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Anyone can help.
I use Home Assistant OS 6.4, core-2021.5.5, supervisor-2021.09.4

Thank you!

1 Like

Thank you for this very nice add-on!

Hi,
thank you for creating this add-on!
I just tried installing it but get the following error when I try to configure it:

Failed to save add-on configuration, Missing required option 'host' in Samba Backup (15d21743_samba_backup). Got {'host': None, 'share': None, 'target_dir': '', 'username': '', 'password': '', 'keep_local': 'all', 'keep_remote': 'all', 'trigger_time': '00:00', 'trigger_days': ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], 'exclude_addons': [], 'exclude_folders': []}

I’ve tried these two configs and variations of them but always get the same error:

{
  "host": "192.168.178.xxx",
  "share": "xxx",
  "target_dir": "backups/ha-backups",
  "username": "xxx",
  "password": "xxx?",
  "keep_local": "5",
  "keep_remote": "20",
  "trigger_time": "04:00",
  "trigger_days": ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],
  "exclude_addons": ["core_ssh", "core_duckdns"],
  "exclude_folders": ["ssl"],
  "backup_name": "{type} Backup {date}"
}
host: 192.168.178.xxx
share: xxx
target_dir: 'backups/ha-backups'
username: 'xxx'
password: 'xxx?'
keep_local: 5
keep_remote: 20
trigger_time: '03:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []

What am I doing wrong?

Thank you!

Make sure path “192.168.178.xxx/xxx/backups/ha-backups” is valid.

Thanks. Unfortunately it is. Username and password are also functioning. I can connect to the SMB share and folder via a command line. So that all seems to be working fine.

Figured it out. I had missed a HA update. After installing that saving the samba config worked.

Hi - sorry if I’m being thick here as I’m not too technical - but how do I configure this to backup to a share on a MAC? Looks like it searches for a directory under the Windows naming convention. I have a share set up already :slight_smile:

Do you mean a Mac or MAC (Media Access Code, the hardware address of an ethernet or WLAN card)?
What type of share did you create on your Mac? If it is a samba share (SMB) it should behave the same as a Unix, Linux or Windows server. There is no other naming convention. It is SMB, nothing else. Your Mac is a Unix machine.

@thomasmauerer could it be there has been a change causing the addon to fail?

I didnt change anything from a configuration perspective but it stopped and as such HA stopped eventually with no disk space left …

in the logs I see “parse error: Invalid numeric literal at line 1, column 5” but as I said, the config itself has not changed

Hi, I have a question:

On the one hand, I use Auto-Backup to create various hourly, daily and weekly backups.
In addition, Samba-Backup starts and creates a backup once a day.

Now I have set the parameter “keep_local” to “14” and, as stated in the documentation, all other backups are also deleted. I don’t really want that.

Is it possible that Samba-Backup only deletes its own backups?

Or can the deletion for all variants be outsourced to a separate automation?

Thank you very much.

It might have been obvious to others, but it was a lightbulb moment for me that I could use Samba Backup to point to a OneDrive share on my laptop, which is then synced automatically. All I had to do was create a share of the OneDrive folder in Windows.

I also use Samba Share to expose the HA folders. I then use AOMEI Backupper on my Windows laptop to sync the HA folders to the same folder on which I store the Samba Backup files. Of course each of the HA folders are stored separately.

Samba Backup configuration:

Samba Share configuration:

Folders exposed by Samba Share:

Folders on my OneDrive:
image

AOMEI Syncs: Note that the Backup folder is not synced by AOMEI because Samba Backup does this

Hi
Is any chance to setup in this addon samba backup more than one trigger time ? I want create two backup by day: 12:00 and 00:00

You can disable the automatic backup for the addon and create an automation for your backups.

Option: trigger_time

The time at which a backup will be triggered. The input must be given in format ‘HH:MM’, e.g. ‘04:00’ which means 4 am. You can also use your own Home Assistant automations to trigger a backup - see Manual Triggers for more information. If you want to disable the time-based schedule completely, set the option to manual.

is this addon working for others at the moment? see some reports on the repo and mine has been disabled as its not working at the moment, doesnt copy to file share …