Samba Backup: Create and store backups on a Samba share

Hello I have some problem to get the addon to work. I always get an error message. That the permissions are not correct. I do not know what else to look on the synology.
Where exactly can I find the correct data on the Synology NAS.

  host: 192.168.x.x
  share: NAS
  target_dir: backupha

Error

[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-12-17 11:14:46] INFO: ---------------------------------------------------
[21-12-17 11:14:46] INFO: Host/Share: //192.168.x.x/NAS
[21-12-17 11:14:46] INFO: Target directory: /backupha
[21-12-17 11:14:46] INFO: Keep local/remote: 5/14
[21-12-17 11:14:46] INFO: Trigger time: 05:00
[21-12-17 11:14:46] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[21-12-17 11:14:46] INFO: ---------------------------------------------------
[21-12-17 11:14:47] WARNING: do_connect: Connection to  failed (Error NT_STATUS_NOT_FOUND)
[21-12-17 11:14:47] FATAL: Cannot access share. Unknown reason.
[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.```

First: You don’t have to “x” you local IP addresses. Nobody can reach them!

What you have written above as configuration, can not be the reason for this error!
I think you have this configuration:

  host: //192.168.x.x
  share: NAS
  target_dir: /backupha

You see the “//” and the “/” in front of the host and the target_dir? These are written in the error, so they are in your config. Simply delete them, and it should work, if you have a share named “NAS” and a folder inside this share named “backupha” on the server 192.168.x.x.

@thomasmauerer thank you for this add on! Works great, excellent job!

Guys, has anyone figured out how to create an automation so that every time I manually create a snapshot (ie, full/partial snapshot, like before updating etc) it gets sent to the smb share configured in the addon?

Will you develop this tool more? Will be nice to have a “stop addon” before backup.
Google Backup do this, to prevent database failure when restore MariaDB.

Thanks for reply
This is my config:

host: 192.168.1.43
share: NAS
target_dir: backupha
username: backupuser
password: ********
keep_local: '5'
keep_remote: '14'
trigger_time: '00:15'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
backup_name: '{type} Backup {date}'

This is my error:

[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-12-20 07:54:48] INFO: ---------------------------------------------------
[21-12-20 07:54:48] INFO: Host/Share: 192.168.1.43/NAS
[21-12-20 07:54:48] INFO: Target directory: backupha
[21-12-20 07:54:48] INFO: Keep local/remote: 5/14
[21-12-20 07:54:48] INFO: Trigger time: 00:15
[21-12-20 07:54:48] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[21-12-20 07:54:48] INFO: ---------------------------------------------------
[21-12-20 07:54:49] WARNING: session setup failed: NT_STATUS_LOGON_FAILURE
[21-12-20 07:54:49] FATAL: Cannot access share. Login failed. Please check your credentials.
[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.

This error: “NT_STATUS_LOGON_FAILURE” looks totally different than before: “NT_STATUS_NOT_FOUND”. So it seems you have changed your config in the meantime.
The error you now have tells me that you have used false credentials to log on. There is no “backupuser” with the password defined. You should check this!

1 Like

New Error:

[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-12-20 08:48:04] INFO: ---------------------------------------------------
[21-12-20 08:48:04] INFO: Host/Share: 192.168.1.43/NAS
[21-12-20 08:48:04] INFO: Target directory: backupha
[21-12-20 08:48:04] INFO: Keep local/remote: 5/14
[21-12-20 08:48:04] INFO: Trigger time: 00:15
[21-12-20 08:48:04] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[21-12-20 08:48:04] INFO: ---------------------------------------------------
[21-12-20 08:48:04] ERROR: Unable to authenticate with the API, permission denied
[21-12-20 08:48:04] ERROR: Unable to update sensor sensor.samba_backup in Home Assistant
[21-12-20 08:48:04] WARNING: tree connect failed: NT_STATUS_BAD_NETWORK_NAME
[21-12-20 08:48:04] FATAL: Cannot access share. It seems that your configured share does not exist.
[21-12-20 08:48:05] FATAL: I found the following shares on your host. Did you mean one of those?
[21-12-20 08:48:05] FATAL: 
	Sharename       Type      Comment
	---------       ----      -------
	ActiveBackupforBusiness Disk      
	backupcloud     Disk      
	backupha        Disk      Backup Home Assistant
	backupiob       Disk      iobroker Backup
	backupproxmox   Disk      
	backuptimemachine Disk      macbook backup
	backuptom       Disk      
	ben             Disk      
	cloudmuehe      Disk      
	docker          Disk      
	homes           Disk      user home
	music           Disk      System default shared folder
	NetBackup       Disk      System default shared folder
	photo           Disk      System default shared folder
	PlexMediaServer Disk      
	SANDRA          Disk      
	SATOM           Disk      
	scan            Disk      
	surveillance    Disk      System default shared folder
	TIM             Disk      
	TOM             Disk      
	video           Disk      System default shared folder
	web             Disk      System default shared folder
	web_packages    Disk      
	IPC$            IPC       IPC Service ()
	home            Disk      Home directory of haadmin
SMB1 disabled -- no workgroup available
[21-12-20 08:48:05] ERROR: Unable to authenticate with the API, permission denied
[21-12-20 08:48:05] ERROR: Unable to update sensor sensor.samba_backup in Home Assistant
[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.

New Config:

host: 192.168.1.43
share: NAS
target_dir: backupha
username: haadmin
password: ************
keep_local: '5'
keep_remote: '14'
trigger_time: '00:15'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
backup_name: '{type} Backup {date}'

Are you really know what you have to set for the different options?
For the option “share:” you have to set a share from your server! You got a list of shares of your server in the error message. What should this tell you?
You don’t have a share named “NAS” on your server!
You have so many shares on your server, that I think you should know what you are doing there and what the meaning of “share” and “folder” is.

So why do you set “NAS” as a name for a share?

And I think that there is no folder named “backupha” on your share, that you want to reach!

These are the first things I asked you:

So correct these things and it should work!

What is the share name on your NAS device? What folder name where do you want to save the backup to the NAS device? What username did you enter to access the shared folder on the NAS device? What password did you enter to access the shared folder on the NAS device?
This is the data you enter in the add-on!

Thank you for the feedback.
No, I am not sure what exactly has to be entered where and in what form.
This is my Synology Folder:

image

This is my SMB Config

This are my backup user:

Your config should look like this:

host: 192.168.1.43
share: backupha
target_dir: ''

And the user haadmin must be granted write permissions.

1 Like

That looks like “backupha” is your share.
So the config that @thomasmauerer posted should be correct.

Viel Erfolg!

1 Like

Thank you very much it works…
Is there also a possibility to backup several times a day and delete an old backup after 8 days?

Not direct in the configuration. You can manually trigger Samba backup from an Home Assistant automation. This is described in the last part of the documentation under “Manual Triggers”.

The deletion will take place after x backups not after x days. Maybe an automation works here also.

Thanks Carsten.
So I’m sure I’ll get several backups. But how I delete with an Automtion zb after 8 backup, the oldest, there I am then unfortunately over questioned

I can also not tell you (Ich bin da echt Ăźberfragt!). Maybe someone else here has an idea how to handle it.

Hihi Ok verstehe Dich :slight_smile: Thanks

@thomasmauerer have you thought about providing an additional whitelist approach by offering two options include_addons and include_folders?

During this Correct "wait until finished" syntax (e. g. 'wait_for_trigger') - #5 by e-raser question:

Is it possible to manually trigger Samba Backup addon so it creates only a HA backup?

…I was wondering why there´s no such “feature” yet. Currently it’s quite a pain to have SAMBA backup create a partial backup only containing HA + HA config folder because I need to exclude everything else. So I need to maintain a list of things I don’t want (and that list is constantly changing which adds the need to update my exclusion list also) to get what I want. Strange, isn’t it :smiley:

Curious to see if this is something you thought about or what you think of it.

1 Like

I’m struggling to exclude influx db from backups.

Influx db’s url is a0d7b954-influxdb and I took the url from the same place for mariadb and it worked but not for influxdb.

exclude_addons:
  - core-mariadb
  - a0d7b954-influxdb
exclude_folders: []

@thomasmauerer any ideas? I also tried using _ instead of -

I am receiving error despite the fact the addon is apparently connected to my samba. Any ideas?

[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.
[22-01-16 20:12:10] INFO: ---------------------------------------------------
[22-01-16 20:12:10] INFO: Host/Share: 192.168.2.200/Exchange
[22-01-16 20:12:10] INFO: Target directory: Backups
[22-01-16 20:12:10] INFO: Keep local/remote: all/all
[22-01-16 20:12:10] INFO: Trigger time: 20:13
[22-01-16 20:12:10] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[22-01-16 20:12:10] INFO: ---------------------------------------------------
[22-01-16 20:12:12] INFO: Samba Backup started successfully
[22-01-16 20:13:12] INFO: Backup running …
[22-01-16 20:13:12] INFO: Creating backup “Samba Backup 2022-01-16 20:13”
[22-01-16 20:13:13] ERROR: Error occurred! Backup could not be created! Please try again