Automation Snapshot to NAS for dummies

I would like to have automation storing snapshots to external storage, but I probably hit my personal limits while trying to to map folders on NAS.
Does exist any guide to do it? Or add on doing all in one (mapping) even better.

Hi @kajmaj
What is your installation ? hass.io ? Docker ?
on your nas ? on an other server ?

Hello, You are right, I should say it first. Sorry.
I have Hass.io installed on Raspberry Pi3 and Synology NAS.

All in my local network.

For my side i mount my NAS share (samba) on my server.
And i have a script on my crontab which save my files.

it’s an example of /etc/fstab :

//192.168.2.21/docker  /home/gano/.homeassistant/www/surf/tablette cifs  rw,user,username=user,password=password,domain=Workgroup,uid=gano  0 0

This is what I was afraid of. :confused:
Silly questions follow:

  • IP is your NAS?
  • /home/gano/.homeassistant/www/surf/tablette it is folder in hassio root? gano is username I guess. What is this folder dedicated for? Why such a structure?
    My home is completely empty so far :slight_smile:
  • cifs rw,user,username=user,password=password,domain=Workgroup,uid=gano 0 0 ???
    Could you clarify please?

Hi

IP is my nas IP
/home/gano/.homeassistant/www/surf/tablette is my mounting point on my server not on my nas

Cifs is the type of mount username your user nas password your password for user on the nas and gano is the user on my server domain is the domain used on my network

So hypothetically if I understood well this should be my enter to /etc/fstab:
//192.168.1.222/docker /home/K/backup cifs rw,user,amin=user,1234=password
Where

  • //192.168.1.222/hassio/backup will be the dedicated folder in my NAS
    /home/K/backup cifs rw will be folder in my RPi
  • admin my NAS username and 1234 my NAS password
    Am I right?

Are you sure you can’t use rsync instead? Check if your NAS supports it, it’s a much neater solution than samba and some odd script.

There is an Hassio add-on by @mr_bjerre which allows you to make a snapshot and copy that to your NAS.
You have to make a SSH key for getting access from your Hassio server to your NAS. Once that setup it’s just running the add-on via an automation :grinning:

1 Like

I didn’t know that an addon exist…
That would be a better solution than samba.

I know about mr-bjerre/hassio-remote-backup but it returns me back to the starting point.

I have SSH server installed and activated, but I am not able to access NAS folder from Raspberry where I run Hassio :frowning_face:,
If the way hokagegano uses is the right one, it is solved than.
I will try it later on today.

Hmm,
I am doing sthg wrong.
Add on installed, configured, started
Backup automation created, it creates local backup but not transferring it to NAS :confused:

This is my etc/fstab:
//192.168.5.222/volume1/hassio/backup \\HASSIO\backup cifs rw 0 0

and add on log:

starting version 3.2.4
Adding SSH key
Creating local backup: “Automated backup 2018-03-22 18:51”
Backup created: aec4e155
Copying aec4e155.tar to /Hassio/Backup/Full on 192.168.5.222 using SCP
/root/.ssh/config line 4: Missing argument.
lost connection

Any idea please?

Which addon version do you use? Can you share a censored configuration please? I have some time today to look at the addon.

To me it looks like /root/.ssh/config are not being created for some reason.

I use version 0.3.0.
My “censored” config:

  "ssh_host": "192.168.5.222",
  "ssh_port": 22,
  "ssh_user": "root",
  "ssh_key": [
    "ssh-rsa my_key"
  ],
  "remote_directory": "Hassio/Backup/Full",
  "zip_password": "secret_password",
  "keep_local_backup": "5"

And log from last try:

starting version 3.2.4
Adding SSH key
Creating local backup: "Automated backup 2018-03-27 15:44"
Backup created: 0a1ce6dc
Copying 0a1ce6dc.tar to Hassio/Backup/Full on 192.168.5.222 using SCP
Warning: Permanently added '192.168.5.222' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
lost connection

Did you add your public key to /root/.ssh/authorized_keys on 192.168.5.222?

Assuming yes. I am able to connect to root via Putty with ssh key.
But if I want to got to the folder “authorized_keys”:
-bash: /root/.ssh/authorized_keys: Permission denied

Are you able to ssh from your hassio OS to 192.168.5.222? I think I will make an update that clarifies this process

No, I am not able. Only sftp works.

So if I were you, i’d create a new ssh key pair on hassio. Copy the private key to the addon configuration and append the public key to authorized_keys on 192.168.5.222. Let me know if that helps

Hm, it is due to my Synology NAS I guess.
ssh is allowed, but there is no option to enter public key. At least I did not find it.