Samba Backup: Create and store backups on a Samba share

Quite a special use case. You cannot install the addon twice and you would probably run into troubles with the cleanup routines if you have two instances.

If you have the power and disk space, you could of course run the addon every hour to make a backup of the whole system (including InfluxDB). But you have to set the trigger to manual and use your own automation for that. It’s not supported out of the box.

I do have the power and disk space but I don’t want to “waste” it.

Is it possible to call the add-on from an automation with the desired add-on(s) as a parameter?

That’s an interesting idea.

Currently I’m doing the addon nightly automated partial snapshot without the few bulky addons I have. I manually do a full backup every week or so and store it in another location.

No, not possible but it’s not a bad idea. I can make parameters overwritable, but I don’t want to introduce new options in that scenario: so, since there is only an exclude option, this can also only be exclude.

And I think only the parameters that affect the snapshot creation (e.g. backup name, password, exclude options) should be overwritable. The others like host, share and target directory should be fixed as they were already pre-checked before.

Samba Backup 3.0 with quite a few new features is released :tada: :tada:

As requested by multiple users, I’ve worked on the triggers. With this release you can trigger a manual backup from Home Assistant whenever you want, even though you are using the time-based schedule of the add-on. In addion to that I also introduced a new mqtt-based trigger.

The configuration options that affect the snapshot creation (exclude_addons, exclude_folders, backup_name, backup_password) can now be overwritten for a single manual run. Please check the README for the correct usage.

6 Likes

Hello!
That’s a one great add-on. Thanks for sharing! :slight_smile:

Question from myself: Would it be possible to create a simple sensor without the need of using MQTT? I don’t use MQTT myself and setting that up broker for only one sensor seems to be an overkill :wink:

For now you only have the mqtt option. But I’m actually already working on a sensor via the Home Assistant REST API. When I’m finished with that, you have a sensor out of the box.

I’m getting this warning in the Samba Backup log: WARNING: do_connect: Connection to homenas failed (Error NT_STATUS_NOT_FOUND)

I can access the shared folder in windows explorer at \\homenas\HASSIO Backup\Snapshot Backup with local credentials \user and password

My Samba Backup config is:

host: homenas
share: HASSIO Backup
target_dir: Snapshot Backup
username: user
password: password
keep_local: all
keep_remote: all
trigger_time: '00:00'
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []

Have i missed something basic in the config here?

No problem with the same config but using the host IP address rather than hostname.

Yeah I had to use the IP address too. Must be a dns thing.

Wow, this is an awsome plugin! Many thanks for implementing that.
Unfortunately I get the following error message

[18:48:04] INFO: Host: 192.168.XX.5
[18:48:04] INFO: Share: Diskstation
[18:48:04] INFO: Target Dir: backups/homeassistant
[18:48:04] INFO: Keep local: all
[18:48:04] INFO: Keep remote: all
[18:48:04] INFO: Trigger time: 01:00
[18:48:04] INFO: Trigger days: Mon Tue Wed Thu Fri Sat Sun
[18:48:07] INFO: Found local mqtt broker - topic is "samba_backup/#"
[18:48:08] WARNING: tree connect failed: NT_STATUS_BAD_NETWORK_NAME
[18:48:08] FATAL: Cannot access share. Please check your config.

of course the IP is correctly filled out.

any hint what the problem could be our what i can test?
I’m trying to acces an synology NAS

interestingly I can connect via smbclient from another server. But smbclient seems not to be installed on the rpi where homeassistant is running

so I looked at your code an see that you also use smbclient. Unfortunately the smbclient doesn’t seem to be installed on hassio, so I assume that is the issue

smbclient is installed in the container of this addon (the warning is directly coming from smbclient). You won’t find the command in the ssh addon - I assume you’re testing with that.

Since you successfully tested smbclient from another machine. Did you use the exact same config? And is the IP address really reachable from your RPI?

Hi Thomas, thanks for responding. Yes i tested it with the exact same details. And the synology nas is reachable via ping from the rpi. For the Configruation i tried the host with slashes, without, etc… but the error is always the same, that is quite confusing.

And yes I used the ssh add on to test the smbclient directly on the rpi

If I run the following command on the other server it works without any problem
smbclient -U myuser%mypass //192.168.XX.5/backups/

Well, then the name of your share is not “Diskstation”, but “backups”:

share: backups
target_dir: homeassistant
1 Like

that was it :flushed: I could swear I also tried this combination. Now it is working. Many thanks for your help!!!

Something weird is happening when I try to add another exclusion to my backup config (influxDB):

Before saving

After saving

Does not matter where in the list I put it, it always ends up on the line above after saving.

EDIT: false alarm. It was because “-” appears black in the config and I was not adding one.

Now I just have to work out how to theme that text properly (not your problem). Day theme for comparison:

Here it is Samba Backup 4.0 - again a bigger release with new features and improvements. :tada: :tada:

The main new feature is a sensor for Home Assistant which reflects the current status and additionally includes some useful statistics within its attributes. Important: If you already have a sensor called Samba Backup (sensor.samba_backup), make sure to rename or delete it. Otherwise the sensor won’t work correctly.

Mqtt support is now deprecated. Because of the new sensor, I do actually no longer see the need for mqtt in this add-on. For now everything works like in the previous version, but my plan is to completely remove mqtt in order to simplify and cleanup the code. Please use the new sensor instead.

3 Likes