Samba Backup: Create and store backups on a Samba share

Great add-on! I was hesitant to install any and tried to go it alone with Automations but this is really well done.

For anyone else using a Synology who may have gotten error messages, the ‘Share’ was the folder name I created for this program - in my case ‘Pi4b’. It was NOT my Synology’s name nor ‘Workgroup’ which showed up in the File Service Samba settings. Also, not sure if it mattered but, by default, the Synology only has SMB1 as low and SMB2 as high and I changed latter to SMB3.

@thomasmauerer, Hi Im running a Hassio 2021.1.4 on a docker in a Ubuntu 18.04. I installed your add-on 'samba backup' like a 3 weeks ago, saving the files locally and also in my NAS. The add-on worked fine for 10 days and then stop. now when I tryto start the add-on I get an error:

'[22:45:38] WARNING: Server requested LANMAN password (share-level security) but 'client lanman auth = no' or 'client ntlmv2 auth = yes'
tree connect failed: NT_STATUS_ACCESS_DENIED
[22:45:38] FATAL: Cannot access share. Access denied. Please check your share permissions. '


any Idea, 
Thanks

Seems like something in your NAS/SMB config is broken. LanMan is an outdated smb1 dialect. Make sure that at least smb2 is enabled (better smb3).

As requested by multiple users, the latest version now renames the snapshots on the share and does no longer use the slugs for the filenames. The prefix (“Samba_Backup”) is technically necessary because I need a regex search pattern for the cleanup.

In addition to that the add-on does no longer rely on ICMP requests. It turned out that smbclient already includes a reachability check. :grinning:

3 Likes

My NAS is an old DNS-323, and only works with smb1, but had been work for 2 weeks and then stoped.
What I noticed is that my last backup was on January 14 with HA ver 2021.1.2 and supervisor ver 2021.01.4
do you think the new home assistant ver 2021.1.3 or 2021.1.4 or new supervisor ver 2021.01.5 changed something?

What would cause these errors:
WARNING (MainThread) [supervisor.addons.validate] Unknown options host
WARNING (MainThread) [supervisor.addons.validate] Unknown options share
WARNING (MainThread) [supervisor.addons.validate] Unknown options target_dir
WARNING (MainThread) [supervisor.addons.validate] Unknown options keep_local
WARNING (MainThread) [supervisor.addons.validate] Unknown options keep_remote
WARNING (MainThread) [supervisor.addons.validate] Unknown options trigger_time
WARNING (MainThread) [supervisor.addons.validate] Unknown options trigger_days
WARNING (MainThread) [supervisor.addons.validate] Unknown options exclude_addons
WARNING (MainThread) [supervisor.addons.validate] Unknown options exclude_folders

I don’t think so. This addon refuses smb1 since the very first version. It will only work if you explicitely set the compatibility_mode option. But even then LANMAN is too old. So actually this should have never worked then.

Your provided config is a mixture of this and the official Samba add-on, which are two completely different add-ons and have nothing in common. Please read the docs first to see which add-on supports which options.

Well that makes me laugh at least- Who would have thought that I need to use the actual add-on in order for it to work…sheesh I am stupid.
All is working great now, thank you for the help and the great add-on!!!

Thanks for the add-on @thomasmauerer !

It’s really useful!
I want to share with everyone the card I made to track all the data coming from the sensor
(Vanilla home assistant only :wink: No custom card and whatnot)

It’s in french but I am pretty sure you can guess what’s what.

Card configuration here:

type: entities
title: Sauvegarde sur JL-Nas
entities:
  - type: attribute
    entity: sensor.samba_backup
    attribute: last_backup
    name: Dernière sauvegarde
    icon: 'mdi:content-save'
  - type: attribute
    entity: sensor.samba_backup
    attribute: backups_local
    name: Nombre de snapshots dispo. sur la RPi
    icon: 'mdi:raspberry-pi'
  - type: attribute
    entity: sensor.samba_backup
    attribute: backups_remote
    name: Nombre de snapshots dispo. sur le NAS
    icon: 'mdi:nas'
  - type: attribute
    entity: sensor.samba_backup
    attribute: total_backups_succeeded
    name: Nombre de snashots générés avec succès
    icon: 'mdi:check-circle'
  - type: attribute
    entity: sensor.samba_backup
    attribute: total_backups_failed
    name: Nombre d'erreurs de sauvergade
    icon: 'mdi:alert'
  - type: button
    action_name: GO !
    name: Rafraichir le capteur
    icon: 'mdi:refresh'
    tap_action:
      action: call-service
      service: hassio.addon_stdin
      service_data:
        addon: 15d21743_samba_backup
        input: restore-sensor
3 Likes

I’m getting an error and no backup files. I think this started when I updated to version 4.4. The log says:

curl: (28) Failed to connect to supervisor port 80: Operation timed out
[07:58:55] ERROR: Something went wrong contacting the API
[07:58:55] ERROR: Unable to update sensor sensor.samba_backup in Home Assistant

I’ve had no snapshots taken since around the time I upgraded to 4.4.

Any idea what this means?

Thank you!!

I assume the answer is here somewhere, but I couldn’t find it in the thread, Google or addon documentation.

Due to the size of data I want to back up I can now only keep a few backups on Google Drive. I would like Samba backup to run alongside Google Drive backup in order to keep backups longer and avoid removing any data from backups. I don’t see it as a replacement as I still want backups offsite as well.

Anything I need to take into account before implementing Samba backup alongside the running Google Drive backup?

Still getting an error and no backups. Re-installed the add-on and set logging to “debug.”

Here’s what I’m seeing:

[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.
[08:25:39] INFO: Host: 192.168.XXX.XXX
[08:25:39] INFO: Share: ShareName
[08:25:39] INFO: Target Dir: HABackup
[08:25:39] INFO: Keep local: 3
[08:25:39] INFO: Keep remote: 10
[08:25:39] INFO: Trigger time: 08:30
[08:25:39] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[08:25:40] DEBUG: Backups local: 3
[08:25:40] DEBUG: Backups remote: 7
[08:25:40] DEBUG: Total backups succeeded: 37
[08:25:40] DEBUG: Total backups failed: 13
[08:25:40] DEBUG: Last backup: 2021-01-22 04:02
curl: (28) Failed to connect to supervisor port 80: Operation timed out
[08:27:50] DEBUG: 
000
[08:27:50] ERROR: Something went wrong contacting the API
[08:27:50] ERROR: Unable to update sensor sensor.samba_backup in Home Assistant
[08:27:51] DEBUG: 
[08:27:51] DEBUG: putting file samba-tmp123 as \HABackup\samba-tmp123 (0.0 kb/s) (average 0.0 kb/s)
[08:27:51] DEBUG: Starting main loop ...
[08:27:51] DEBUG: Starting stdin listener ...
[08:30:52] INFO: Backup running ...
[08:30:53] DEBUG: Backups local: 3
[08:30:53] DEBUG: Backups remote: 7
[08:30:53] DEBUG: Total backups succeeded: 37
[08:30:53] DEBUG: Total backups failed: 13
[08:30:53] DEBUG: Last backup: 2021-01-22 04:02
curl: (28) Failed to connect to supervisor port 80: Operation timed out
[08:33:03] DEBUG: 
000
[08:33:03] ERROR: Something went wrong contacting the API
[08:33:03] ERROR: Unable to update sensor sensor.samba_backup in Home Assistant
[08:33:03] INFO: Creating snapshot "Samba Backup 2021-02-01 08:33"
parse error: Invalid numeric literal at line 1, column 5
parse error: Invalid numeric literal at line 1, column 4

Still looking for ideas on why this would have suddenly started happening, apparently after I updated to the latest version.

Thank you!!

It’s been over a month since we’ve seen the author of this add-on here. Anyone know if he’s alright? Still interested in HA?

I’ve had to un-install the add-on, not sure if there’s a process to flag it as abandoned.

Why? It’s working fine here. I do not have the error you mentioned

It also works well for me and regularly saves images to the smb server.

I am sorry if I missed it and it was already answered here, but is it possible to use this addon to only upload already created backup snapshots to samba server without creating new snapshots?

As I already have automated management of snapshots with different retention for incremental and for full snapshots, it would be great to not have to completely rework it just to upload snapshots to samba.

No, that’s not possible. This addon can only copy the snapshot it created. It does not synchronize the backup folder with a remote location.
But take a look at the Manual Triggers section. Probably you can reuse your automation logic.

@CaptTom Your issue is not reproducible. There must be something messed up in your environment if a addon (which runs in the supervisor scope) is not able to reach the supervisor API. I cannot tell the exact reason.

Thanks for providing this addon, make life a lot easier. I’ve got it up and running. I found a post regarding using the secrets.yaml file. But there seems to be a minor issue, especially when using special characters.

For one of my sensor I use a password containing \ and ". I’ve configured an entry in secrets.yaml, like:

system_passwd: 3hdgh\"j5

and it works with my configured sensor, but not with Samba Backup. For Samba Backup I found the solution:

system_passwd2: "3hdgh\\\"j5"

escaping \ and ". This works with Samba Backup, but not with my sensor.

As I use the username and password for the integration of my NAS, as well as for Samba Backup, it would be helpful, to just have one password.