Samba Backup: Create and store backups on a Samba share

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:).

I think that changed in 0.99: https://www.home-assistant.io/blog/2019/09/18/release-99/#hassio

Ok interesting. But then I think it should actually work out of the box without changes in the add-on itself. I’ll check that out later.

I just tested it and it is working out of the box. Awesome, I did not know that!
If you get “invalid yaml syntax”, you probably have to enclose it in quotation marks:

username: '!secret your_user'
password: '!secret your_pass'
3 Likes

Not sure if you are aware but this is a good RSS feed to subscribe to: https://developers.home-assistant.io/blog/

1 Like

Hello, newbie having trouble setting this up correctly…

everything in log good until…

[21:50:27] FATAL: The provided host is unreachable. Please check your config.
[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 is my config:

host: 'homeasistant.local:8123'
share: backup
target_dir: HomeAssistant
username: xxxxx
password: 'xxxxxxx'
keep_local: '5'
keep_remote: '20'
trigger_time: '22:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []

Any help please…

You need to specify the IP address of your NAS in the host field, not home assistant.

2 Likes

Samba Backup seems to be filling the supervisor log with a large number of warnings:

20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_nodered not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_thelounge not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_foldingathome not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_aircast not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_unifi not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_airsonos not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_mqtt not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on core_almond not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_matrix not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on f3248fb7_rtl4332mqtt not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on 15ef4d2f_esphome-dev not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on 243ffc37_ympd not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on core_tellstick not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_ftp not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on 243ffc37_icantbelieveitsnotvaletudo not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on core_configurator not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_chrony not found/installed
...etc
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on core_check_config not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_tautulli not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_phlex not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_appdaemon not found/installed
20-11-02 15:16:00 WARNING (MainThread) [supervisor.snapshots] Add-on a0d7b954_zerotier not found/installed
20-11-02 15:16:00 INFO (MainThread) [supervisor.snapshots] Snapshotting fd08f1da store Add-ons
20-11-02 15:16:00 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on a0d7b954_glances
20-11-02 15:16:00 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon a0d7b954_glances
20-11-02 15:16:00 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on core_duckdns
20-11-02 15:16:00 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon core_duckdns
20-11-02 15:16:00 INFO (MainThread) [supervisor.addons.addon] Building snapshot for add-on core_mariadb
20-11-02 15:17:09 INFO (MainThread) [supervisor.addons.addon] Finish snapshot for addon core_mariadb
...etc

Yes you’re right. The supervisor API slightly changed which now requires a small adaption in this add-on. I will fix that in v4.2.

1 Like

Thanks! I’ll go try that now!