Samba Backup: Create and store backups on a Samba share

It could be I who misunderstands. I thought the snapshot is created on the HA system and copied to the external SMB device (like a NAS.)

I was just wondering whether there was a way to select where on the local (HA) system to store it, OR to create it directly on the NAS.

Yes. Thatā€™s how it works.

No. That is not possible.

I guess I understand. I have it set so that I leave the latest 1 image in HA (snapshots) and every day I send the image to a remote smb server. So I have 7 images stored for a whole week.

I have the same question as others. Since the backup filenames are not identifiable, how do I know which one I want to restore to? Great addon, but this is something that is missing in my opinion.

Look at the file creation date.

There is a json file in the archive with the backup name. I have some bash code to extract the name if you are interested.

Thanks I was thinking about this more and realized I could always copy the backups back into home assistant and then the names would show up in the UIā€¦ then I would be able to pick the one I want to restore.

Backing up a little, one thing I was hoping to accomplish was this:

I just realized thereā€™s another way to accomplish this. The snapshot isnā€™t in the ā€œconfigā€ share, which would be very convenient (assuming weā€™re in there poking around a lot anyway.)

But it is in a share called (duh) ā€œbackup.ā€ No need to SSH in and use command-line to view it.

Since I always connect to the config share, Iā€™d sort of forgotten there are others.

Cool add-on. Plugged an old USB stick into my Fritz Box and it worked right out of the box. My config ā€¦

host: 192.168.178.1
share: FRITZ.NAS
target_dir: CCCOMA_X64F\ha
username: xxx
password: xxx
keep_local: all
keep_remote: all
trigger_time: '00:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
backup_name: '{type} Snapshot {version} {date}'

Note that CCCOMA_X64F is the name of the USB stick and username/password are credentials I set in [System > FRITZ!Box-Benutzer > Benutzer]

-Stefan

Hi,

Just installed add-on and working great, but can only get it to do partial backups.
Is my config wrong?

host: 192.168.0.xx
share: Backups
target_dir: autobackup
username: xxx
password: xxx
keep_local: '5'
keep_remote: '20'
trigger_time: '04:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons:
  - core_ssh
  - core_duckdns
exclude_folders:
  - ssl
type: Full
backup_name: '{type} Snapshot (Samba Backup) {date}'

Thanks in advance.

Kind Regards,

Mark

ā€¦Ignore that.
Changed the config to

host: 192.168.0.xx
share: Backups
target_dir: autobackup
username: xxx
password: xxx
keep_local: '5'
keep_remote: '20'
trigger_time: '04:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
type: Full
backup_name: '{type} Snapshot (Samba Backup) {date}'

And all working fine.

Thanks for the really useful add on.

I cannot get this to work, but my setup may be different or unsupported. Iā€™m backing up to a Mac running SMB (I can access via any windows computer) and despite the fact that my username and password are correct I still get an error when I try to run the backup:

[10:29:16] DEBUG: PING 10.1.200.2 (10.1.200.2): 56 data bytes
64 bytes from 10.1.200.2: seq=0 ttl=63 time=0.816 ms
64 bytes from 10.1.200.2: seq=1 ttl=63 time=0.636 ms
64 bytes from 10.1.200.2: seq=2 ttl=63 time=0.622 ms
64 bytes from 10.1.200.2: seq=3 ttl=63 time=0.603 ms
--- 10.1.200.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.603/0.669/0.816 ms
[10:29:16] WARNING: session setup failed: NT_STATUS_LOGON_FAILURE
[10:29:16] FATAL: Cannot access share. Login failed. Please check your credentials.

To try to debug this I opened an SSH to my HASS system and could not execute the SMB client, so Iā€™m not sure if perhaps that is the problem or what:

~ $ smbclient
-bash: smbclient: command not found

I saw above in another reply that smbclient may not be on the HASS system but is in your package, so I tried to find it and got nothing:

find / smbclient
find: smbclient: No such file or directory

My config:

host: 10.1.200.2
share: home_assistant
target_dir: ''
username: myname
password: mypass
keep_local: '5'
keep_remote: '20'
trigger_time: '01:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
backup_name: '{type} Home Assistant Snapshot (Samba Backup) {date}'
log_level: debug

Very grateful for this excellent add-on, thanks so much!

Small tip in case anyone faces the same issue I had:
If your samba_backup sensor gives failed as a status and the logs in the add-on look something like this:

date: invalid date 'A 4915200 Wed Nov 11 21:51:39 2020'
date: invalid date 'A 4505600 Tue Nov 10 22:03:36 2020'
[23:46:08] INFO: Deleting  on share
[23:46:08] WARNING: del <filename>
[23:46:08] INFO: Deleting  on share
[23:46:09] WARNING: del <filename>

Then in reality your backup probably went just fine but it just had some problems with managing older snapshots on your backup Samba location.
I had at one point renamed 2 snapshots on that folder. When I deleted those snapshots, the samba backup addon stopped producing errors and the sensor gave succeeded as a result.

1 Like

Could you try with a target dir ?

Addon works as expected for me, which is good because I always forget to make a snapshot before breaking changes :D.

The only feature lacking is using the description in the filename. Thereā€™s a workaround (file timestamp), but synchronisation between the files on the share and the snapshots would be very nice.

That didnā€™t make any difference, same error. I wasnā€™t certain it would change anything since the failure is NT_STATUS_LOGON rather than folder not found or something similar.

Isnt it a partial backup because you exclude addons and folders?

Yep, absolutley correct. As I said previously, all working fine now.

Hello and thanks for reading this in advance. I have tried many different ways, but I am still at a loss for my specific situation, so I thought I would post here:

I have installed the add-on and all seems to work just fine for Windows being able to see the HA drive using Samba Backup.

My problem is when I try to use automate the configuration:

workgroup: WORKGROUP
username: XXXXX
password: XXXXX
interface: eth0
allow_hosts:
-10.0.0.0/8
-172.16.0.0/12
-192.168.0.0/16
-ā€˜fe80::/10ā€™
veto_files:
-._*
-.DS_Store
-Thumbs.db
-icon?
-.Trashes
compatibility_mode: false
host: 192.168.1.14
share: homes
target_dir: HABackups
keep_local: all
keep_remote: all
trigger_time: ā€˜05:07ā€™
trigger_days:
-Mon
-Tue
-Wed
-Thu
-Fri
-Sat
-Sun
exclude_addons: []
exclude_folders: []

I get errors no errors in the Samba Backup addon, but I do get them in my Supervisor HA log:

INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
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
INFO (SyncWorker_1) [supervisor.docker.interface] Stopping addon_core_samba application
INFO (SyncWorker_1) [supervisor.docker.interface] Cleaning addon_core_samba application
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
INFO (SyncWorker_6) [supervisor.docker.addon] Starting Docker add-on homeassistant/aarch64-addon-samba with version 9.3.0

And I donā€™t seem to be able to automate the snapshots backups successfully, which I assume is due to the above errors. It seems like everything below and including ā€œhostā€ in my configuration is incorrect.

If anyone is able to point me in the right direction, it would be much appreciated.

Wanted to say thanks for this add-on

I installed and setup last night. Overnight it ran, and there was a new backup for me this morning.

My NAS is a USB drive attached to my Netgear router, configured using their readyshare setup.

My configuration setup was
host: 192.168.xxx.xxx
share: USB_Storage
target_dir: img

where img is a directory in the share named USB_Storage.
Took me a few attempts to figure it out, but the log output tells you if there is a problem, and after I used the above it worked great.

Randy