Samba Backup: Create and store backups on a Samba share

“Protocol negotiation failed” means that your share only supports old SMB1 protocols. Please check the compatibility_mode option in the docs (or better check how to enable SMB2/SMB3 in your NAS settings).

Since I see quite a lot of people having troubles with the config, I extended and improved the pre-checks in v4.1.

Samba Backup now evaluates the smbclient status codes and gives much better hints what the concrete configuration problem is. In case of a connection error, it logs the list of all available shares that were found on the given host.

2 Likes

Thanks, mine just started working 3 days ago without me touching it…

Backup integration works great. Thank you all.

nas

Only one problem in my installation, if i restart HA for any reason, sensor.samba_backup not exist after HA finish loading. I have to restart add-on and I can see sensor.samba_backup in Developer Tools and on UI.

This is covered in the docs. You need to add a startup automation (or wait until the next time the addon runs). See here: https://github.com/thomasmauerer/hassio-addons/blob/df058f1452ee1306f1b63688d38b8f321f8c1d19/samba-backup/DOCS.md#home-assistant-sensor

Thank you, very simple fix.

I just found this add-on.
Thank you, it’s working perfectly and saving backups to my NAS. Great documentation, too! Took me only minutes to get everything up and running!

I’d love to have another attribute of the sensor: Was the last backup successful or did it fail? Could this be included in the next update?

For anyone interested: These are my automations to alert me on the backups as they happen (in my automations.yaml):

- id: notify_failed_backup
  alias: Notify on failed backup
  trigger:
    - entity_id: sensor.samba_backup
      platform: state
      to: 'FAILED'
  action:
  - service: notify.telegram
    data_template:
      message: '❌ Home Assistant backup to NAS failed!'
- id: notify_succesfull_backup
  alias: Notify on succesful backup
  trigger:
    - entity_id: sensor.samba_backup
      platform: state
      to: 'SUCCEEDED'
  action:
  - service: notify.telegram
    data_template:
      message: '✅ Home Assistant backup to NAS succeeded!'
1 Like

Hey Thomas, I noticed a worrying trend with the new supervisor monitors that could be due to SAMBA backup, as the CPU starts to rise just after SAMBA backup runs.

The actual backup task is quite small and completes in 6 seconds:

sambabkup

Now this is far from conclusively an issue with this addon, I was just wondering if you or anyone else were seeing something similar?

Interesting. I did not see this behavior on my setup and I’m actually pretty sure that this is not caused by this addon. Because the only thing I do with Home Assistant core is posting a sensor via its API. And this is never done in IDLE mode. So there is actually nothing which would produce CPU load on Home Assistant core. During a backup it’s normal that supervisor will go up to 100%, but this is not related with core.

I guess it’s rather an integration that causes this issue.

If you are familiar with ssh and want to do some live monitoring while investigating the problem, you can create a simple script:

#!/bin/bash

while true; do
    core=$(ha core stats --raw-json | jq .data.cpu_percent)
    sup=$(ha supervisor stats --raw-json | jq .data.cpu_percent)

    echo "Core Usage: ${core}"
    echo "Supervisor Usage: ${sup}"
    echo "------------------------"
    sleep 1
done
1 Like

Thanks,. Yeah like I said, I was doubtful it was this addon. The fact that you are not seeing it means I have to look elsewhere.

Actually you already have this information because of the state (and your automations).

By chance are you on .116.0?
A lot of people saw similar issues during the HA nightly cleanups. I believe it was database related and was resolved (at least for me) in subsequent updates.

No, I’m on 0.116.2.

EDIT: also it happened again today. Definitely not related to SAMBA backup.

Is it required not only to backup the .tar file but also the describing (json?) file?
Last week I had to restore a backup (thanks a lot(!) for enabling to have a backup on my NAS). I tried the new fresh-install restore option of 0.116) but it did not work (type error, see How to restore a snapshot )
After continuing the fresh install, and adding samba addon I was able to restore the backup (with a remark about the missing file in the logs)

Missing file: [supervisor.snapshots.snapshot] Can't read snapshot tarfile /data/backup/e0ddd720.tar: "filename './snapshot.json' not found"

Hmm… maybe your snapshot is corrupt for whatever reason. The “snapshot.json” file should actually be included in the tar. There is no separate file. You could extract the tar file to see that the snapshot.json is included: tar -xvf <slug>.tar

Yes, I see that I kind of have the information. I could set a input_text in my automation to either ‘Success’ or ‘Fail’ and persist the information this way.
I’d rather have an ‘object’ (in this case the sensor) containing all information, rather than creating ‘random’ inputs that are not really inputs, but really variables, thus cluttering the entities list.
Or I could trigger an AppDaemon Script to add the information to the sensor itself. But this too seems rather involved… :wink:
Is that what you meant? Or am I missing something?
Thanks! :slight_smile:

Thanks for your feedback. The json file is in and readable… guess no issue in creation of backup…

Feature request: add support for !secret, i.e., storing username and password in secrets.yaml.

I tried just to see if it would work but the add-on configuration page reported “invalid yaml syntax” as soon as I typed !secret after username:.

That’s a pure Home Assistant thing, not meant for add-ons. In fact, the add-on is not even allowed to read your configs and secrets (which is in general a good thing I would say :slightly_smiling_face:).