Backup Home Assistant data to a Diskstation using rsync
How to setup rsync on a Synology Diskstation and use it to backup data from Home Assistant to the NAS.
Enable & configure Rsync on Diskstation
- Login to your Diskstation
- Go to Control Panel > File Services > rsync Tab
- Under
rsync
checkEnable rsync service
& checkEnable rsync account
and clickApply
. This will create a shared folderNetBackup
. -
Next create a user (Control Panels > User > Create) which will be used for using rysnc. e.g. I named mine
home_assistant_rsync
.- Give the user the Permission to Read & Write the NetBackup folder
- Under Applications allow to use rsymc (Shared Folder Sync, ...).
-
Next add the User to the external rsync Accounts
- Go to Control Panel > File Services > rsync > Click
Edit rsync Account
Add
the created user and make sure to enter a password.
- Go to Control Panel > File Services > rsync > Click
That's it, now you can check your configuration e.g. by trying to upload a test.txt
file.
rsync -av --dry-run test.txt home_assistant_rsync@<YOUR_DS_IP>::NetBackup
Troubleshooting:
I received the error: @ERROR: auth failed on module NetBackup
. This will happen if you do not enter a password when adding your user to the external rsync Accounts.
Just enter a password for your external rsync user under Control Panel > File Services > rsync > Click Edit rsync Account > Edit. Aftwards it worked.
Rsync data from Home Assistant to Diskstation
I use the Folder Rsync Addon to transfer all Home Assistant folders (config, addons, ...) to the Diskstation.
- Install Folder Rsync
- Configure Application:
rsyncserver: <IP_OF_YOUR_DISKSTATION>
rootfolder: NetBackup/hassio-backup
username: <RSYNC_USER_ON_YOUR_DISKSATION>
password: <RSYNC_USER_PASSWORD>
- make sure to create the subfolder (in my case
hassio-backup
) in the NetBackup module on your diskstation, otherwise it throws an error that the folder does not exist. - Click start to run the rsync once and watch the addon log to check if everything works.
Now you can start the sync from an automation (see addon docs):
- id: '7'
alias: Folder sync to NAS
trigger:
platform: time
at: '1:00:00'
action:
- service: hassio.addon_start
data:
addon: 954f2f4e_folderrsync
Or e.g. I trigger it within NodeRed with following node configuration: