Samba Backup: Create and store backups on a Samba share

All of my samba backup entities stopped working with the latest update…but I am not sure why - does anyone know? I had them setup like this:

  - type: entities
    entities:
      - entity: sensor.home_assistant_v2_db_size
        icon: mdi:database
        name: Database Size
      - entity: sensor.samba_backup
        icon: mdi:file-replace-outline
        name: Backup Status
      - attribute: backups_local
        entity: sensor.samba_backup
        icon: mdi:file-outline
        name: Local Backups
        type: attribute

Maybe because “Attributes” has been “moved” to another table … but i really don’t understand why/how attributes are used here, is it just to show a state, or an actual “function” ? … are your “entity” gone, … sensor.samba_backup ?

The entity exists. I am not 100% clear on why they are used - I was just copying the examples that were in this thread previously. I will dig into that point on attributes being moved to another table.

You should rather look into your samba configuration, and why the sensor.samba_backup not shows in your “card” as i assume you are showing here … im sure you can’t base your statement upon what a card shows

So check whether backup actually works, if not check your logfiles

My sensor.samba_backup entity occasionally goes missing. Can’t say why because I only notice it when I look at a specific dashboard and it’s the one that I use the least. Whenever this happens I simply restart the addon and it reappears. This has happened on multiple previous versions of HA.

It has never affected the actual backups…they work as scheduled…just the sensor goes missing.

1 Like

The backup function works fine. The attributes were used to display things like the amount of backups attempted, backups completed, and date of last successful backup. It worked that way for 3 months until I did the most recent update. This is an example of how it used to look:


And this was the guide I followed:

1 Like

ok, yes mysterious exist even here in HA :slight_smile: … and actually 1 other sensor went missing for me(in the browser), after latest update(thou working fine), took awhile to get it back … maybe some “functionality” was changed, but not affecting the entity/integration , question is whether it’s in core/frontend or the Browser or Card used(.js)
But yes clearing browser/check on other device, restarting Integration/Add-On, HA , OS in that order is “standard” procedure in such troubleshooting cases

I think there’s something wrong with your config.
my entities / dashboard looks fine with up-to-date config.

Would you mind pasting yours in here?

I would love to use this backup but for reasons I don’t understand it fails. See log below. The target directory (HABackup) is in my QNAP NAS. According to the log, Samba Backup can access other directories and even lists HABackup as one it sees, yet the log says that it “cannot access share”. I can save test files just fine using my Windows computer into this directory.
I apologize in advance if this has been already answered previously. Any hints would be very welcome.

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.
[22-04-10 20:04:54] INFO: ---------------------------------------------------
[22-04-10 20:04:54] INFO: Host/Share: 192.168.1.4/MAINNAS
[22-04-10 20:04:54] INFO: Target directory: HABackup
[22-04-10 20:04:54] INFO: Keep local/remote: all/all
[22-04-10 20:04:54] INFO: Trigger time: 00:00
[22-04-10 20:04:54] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[22-04-10 20:04:54] INFO: ---------------------------------------------------
[22-04-10 20:04:55] WARNING: tree connect failed: NT_STATUS_BAD_NETWORK_NAME
[22-04-10 20:04:55] FATAL: Cannot access share. It seems that your configured share does not exist.
[22-04-10 20:04:55] FATAL: I found the following shares on your host. Did you mean one of those?
[22-04-10 20:04:55] FATAL:
Sharename Type Comment
--------- ---- -------
Multimedia Disk System default share
Download Disk System default share
Recordings Disk System default share
Web Disk System default share
Public Disk System default share
Data Disk Data Backup
Qsnyc Disk Qsnyc Folder
homes Disk System default share
Archives Disk Old Archived Data
QmailAgent Disk
home Disk Home
HABackup Disk Home Assistant Backup
My Book Disk USB storage share
IPC$ IPC IPC Service (NAS Server)
SMB1 disabled – no workgroup available
[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.

@pieslinger, I’m using plain entity card (ignore first two entries, it’s a system status card):

type: entities
entities:
  - entity: sensor.rpi_cpu_temperature
  - entity: binary_sensor.rpi_power_status
  - entity: sensor.samba_backup

And persistent sensor automation after reboots:

alias: SMB sensor restore
description: Restore Samba Backup sensor on startup
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: hassio.addon_stdin
    data:
      addon: 15d21743_samba_backup
      input: restore-sensor
mode: single

All according to official documentation.
Make sure there are no errors in the plugin (maybe smb error config is wrong). Also check GUI editor, maybe entities names are somehow changed.

@GAK something’s misconfigured.
Host/share should be only the IP.

Host/Share: 192.168.1.4/MAINNAS

Should probably become:

Host/Share: 192.168.1.4
1 Like

Thanks for your help. What happened was the samba backup add on was not running. Start on boot was checked…but it was off. Embarrassing…but I will keep that in thread in case it helps others!

Sorry for wasting your time.

1 Like

My configuration is as shown below.
What puzzles me is that the log says “It seems that your configured share does not exist”, yet HABackup is listed among the discovered shares after the phrase: “I found the following shares on your host. Did you mean one of those?”.

CONFIGURATION

host: 192.168.1.4
share: MAINNAS
target_dir: HABackup
username: xxxxx
password: yyyyy
keep_local: all
keep_remote: all
trigger_time: ‘00:00’
trigger_days:

  • Mon
  • Tue
  • Wed
  • Thu
  • Fri
  • Sat
  • Sun
    exclude_addons: []
    exclude_folders: []

Partial LOG

[22-04-11 16:13:12] FATAL: Cannot access share. It seems that your configured share does not exist.
[22-04-11 16:13:12] FATAL: I found the following shares on your host. Did you mean one of those?
[22-04-11 16:13:12] FATAL:
Sharename Type Comment
--------- ---- -------
Multimedia Disk System default share
Download Disk System default share
Recordings Disk System default share
Web Disk System default share
Public Disk System default share
Data Disk Data Backup
Qsnyc Disk Qsnyc Folder
homes Disk System default share
Archives Disk Old Archived Data
QmailAgent Disk
home Disk Home
HABackup Disk Home Assistant Backup
My Book Disk USB storage share
IPC$ IPC IPC Service (NAS Server)
SMB1 disabled – no workgroup available

You are trying to access a share called “MAINNAS”, but like the addon suggests, the discovered share is called “HABackup”. So the config should look like this:

host: 192.168.1.4
share: HABackup
target_dir: ''
2 Likes

Thanks very much thomasmauerer! Samba Backup now has started successfully. I really appreciate your patience and help.

Hi,
I have problem with creating backup on usb stick that is connected to fritz box router. This is the error I get:

[22-04-17 10:13:48] WARNING: cli_push returned NT_STATUS_IO_TIMEOUT
NT_STATUS_CONNECTION_DISCONNECTED closing remote file \USB_BACKUP\ha-backup\Samba_Backup_2022_04_17_09_48.tar
[22-04-17 10:13:48] WARNING: Could not copy backup 9add50a5 to share. Trying again ...
[22-04-17 10:18:43] WARNING: cli_push returned NT_STATUS_IO_TIMEOUT
NT_STATUS_CONNECTION_DISCONNECTED closing remote file \USB_BACKUP\ha-backup\Samba_Backup_2022_04_17_09_48.tar

Backup file is 3.1 GB. It creates file on usb stick and start copying file. I get this error when backup copy is around 10% of backup file.
This is my samba backup config

host: 192.168.178.1
share: FRITZ.NAS
target_dir: USB_BACKUP/ha-backup
username: username
password: password
keep_local: '0'
keep_remote: '10'
trigger_time: '23:00'
trigger_days:
  - Wed
exclude_addons: []
exclude_folders: []
workgroup: BACKUP

Maybe backup file is too big or there is some issue with io timeout. Can io timeout be increased?

I also have this problem, usually this happens when I update HA.

To fix it I restart the addon, when it is restarted everything works again.
@thomasmauerer any idea of why?

Hello everyone,

Thanks @thomasmauerer for this nice add-on.

Is that possible to call our logins from !secret ?

Thanks,

Hi there,

I am using Samba Backup daily with great success so thanks for the hard work.

Recently I integrated my Nest cameras which store clips under config/nest/event_media. These files are resulting in daily backups in excess of 500mb. I don’t wish to disable them from being stored within Home Assistant however I don’t need to back them up. I have reviewed Samba Backup and I see that you can exclude folders, however it appears that you can only exclude homeassistant , ssl , share , addons/local and media folders.

Is there some other way to exclude the Nest folders?

Below is my config: As you will see, I attempted excluding the Nest folders (without success)

host: 192.168.4.12
share: holmes
target_dir: acomputer/backups/home assistant
username: tomthumborsomeotherusernamewhichwouldbevalidatedonmynetwork
password: Myverspecialpasswordwhichnoonewouldeverguessin1millionyearsmaybemorenothisisnotmyrealpassword
keep_local: 3
keep_remote: 5
trigger_time: '22:43'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders:
  - config/nest
  - media
backup_name: '{type} Backup {date}'

Thank you!

Tom

I had a couple days of successful backups but just last night it started failing and I’m not sure why. Hoping someone can help me solve this issue. I confirmed my backup location has plenty of free space.

[22-04-25 12:39:48] INFO: ---------------------------------------------------
[22-04-25 12:39:48] INFO: Host/Share: 10.4.20.55/HomeServer
[22-04-25 12:39:48] INFO: Target directory: hassio/
[22-04-25 12:39:48] INFO: Keep local/remote: 7/4
[22-04-25 12:39:48] INFO: Trigger time: 12:40
[22-04-25 12:39:48] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[22-04-25 12:39:48] INFO: ---------------------------------------------------
[22-04-25 12:39:48] DEBUG: Backups local: 6
[22-04-25 12:39:48] DEBUG: Backups remote: 2
[22-04-25 12:39:48] DEBUG: Total backups succeeded: 2
[22-04-25 12:39:48] DEBUG: Total backups failed: 6
[22-04-25 12:39:48] DEBUG: Last backup: 2022-04-24 00:35
[22-04-25 12:39:48] DEBUG: API Status: 200
[22-04-25 12:39:48] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "IDLE", "attributes": {"friendly_name": "Samba Backup", "backups_local": "6", "backups_remote": "2", "total_backups_succeeded": "2", "total_backups_failed": "6", "last_backup": "2022-04-24 00:35"}, "last_changed": "2022-04-25T18:35:06.790031+00:00", "last_updated": "2022-04-25T18:35:06.790031+00:00", "context": {"id": "430169b419ac5c240a0f11e37ae4bc7d", "parent_id": null, "user_id": "36177278c3f64e969fb15483d4ee2fef"}}
[22-04-25 12:39:48] DEBUG: 
[22-04-25 12:39:48] DEBUG: putting file samba-tmp123 as \hassio\samba-tmp123 (0.0 kb/s) (average 0.0 kb/s)
[22-04-25 12:39:48] INFO: Samba Backup started successfully
[22-04-25 12:39:48] DEBUG: Starting stdin listener ...
[22-04-25 12:39:48] DEBUG: Starting main loop ...
[22-04-25 12:40:48] INFO: Backup running ...
[22-04-25 12:40:48] DEBUG: Backups local: 6
[22-04-25 12:40:48] DEBUG: Backups remote: 2
[22-04-25 12:40:48] DEBUG: Total backups succeeded: 2
[22-04-25 12:40:48] DEBUG: Total backups failed: 6
[22-04-25 12:40:48] DEBUG: Last backup: 2022-04-24 00:35
[22-04-25 12:40:48] DEBUG: API Status: 200
[22-04-25 12:40:48] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "RUNNING", "attributes": {"friendly_name": "Samba Backup", "backups_local": "6", "backups_remote": "2", "total_backups_succeeded": "2", "total_backups_failed": "6", "last_backup": "2022-04-24 00:35"}, "last_changed": "2022-04-25T18:40:48.660128+00:00", "last_updated": "2022-04-25T18:40:48.660128+00:00", "context": {"id": "12dcbb9862d4173d60747877a3990b47", "parent_id": null, "user_id": "36177278c3f64e969fb15483d4ee2fef"}}
[22-04-25 12:40:48] INFO: Creating backup "Samba Backup 2022-04-25 12:40"
[22-04-25 12:45:14] ERROR: Error occurred! Backup could not be created! Please try again
[22-04-25 12:45:15] DEBUG: API Status: 200
[22-04-25 12:45:15] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "FAILED", "attributes": {"friendly_name": "Samba Backup", "backups_local": "6", "backups_remote": "1", "total_backups_succeeded": "2", "total_backups_failed": "7", "last_backup": "2022-04-24 00:35"}, "last_changed": "2022-04-25T18:45:15.075974+00:00", "last_updated": "2022-04-25T18:45:15.075974+00:00", "context": {"id": "d1224747e0cd547979c21e1f62fb49a0", "parent_id": null, "user_id": "36177278c3f64e969fb15483d4ee2fef"}}
[22-04-25 12:45:25] DEBUG: API Status: 200
[22-04-25 12:45:25] DEBUG: API Response: {"entity_id": "sensor.samba_backup", "state": "IDLE", "attributes": {"friendly_name": "Samba Backup", "backups_local": "6", "backups_remote": "1", "total_backups_succeeded": "2", "total_backups_failed": "7", "last_backup": "2022-04-24 00:35"}, "last_changed": "2022-04-25T18:45:25.128420+00:00", "last_updated": "2022-04-25T18:45:25.128420+00:00", "context": {"id": "e72ef5f00698044873d216a50c80ff36", "parent_id": null, "user_id": "36177278c3f64e969fb15483d4ee2fef"}}
[22-04-25 12:45:25] INFO: Backup finished