This instruction explains the steps to synchronise shared folders on two different Synology NAS servers via the rsync protocol. The rsync commando’s are executed in a terminal session that’s why SSH must be enabled on both Synology NAS servers. Be careful running the terminal commands because files and folders can be deleted, running the commands are at your own risk
Turn on rsync on Synology NAS
In this scenario both Synology NAS-servers should have the rsync service running otherwise the Synology rsync synchronisation terminal commands won’t run.
Control Panel, File Sharing, File Services, rsync, select “enable rsync service”
Identify both folders for Synology rsync synchronisation
Choose which folder on the source Synology NAS you want to synchronise to the other Synology NAS server which will be the destination.
Synology rsync synchronisation terminal commands
Let me start by saying to be careful how you proceed with the following commands because they will overwrite and delete files and folders! So test first and check.
Run the following Synology rsync synchronisation terminal commands at your own risk!
Scenario:
Name Source Synology NAS server: server01
Name Destination Synology NAS server: server02
Shared folder on server01: test test
Shared folder on server02: test test
volume: volume1
Access DSM via SSH
Login as a admin user but don’t change to root user.
Launch the terminal application on your computer.
Type the following command and press Enter:
ssh <DSM_admin_account>@<DSM IP address>or<DNS_Name> -p SSH_ port_number
Enter the password of your DSM administrator account
Example:
ssh myadmin@10.17.2.6 -p 22
Synchronise from server01:
- Run “rsync” command from server01, not as root
rsync -avhz –delete “/volume1/test test/” <admin user>@server02:”‘/volume1/test test/'”
Synchronise from server02:
- Run “rsync” command from server02, not as root
rsync -avhz –delete <admin user>@server01:”‘/volume1/test test/'” “/volume1/test test/”
Meaning switches rsync command
-a, –archive archive mode; equals -rlptgoD (no -H,-A,-X)
-v, –verbose increase verbosity
-h human readable
-z, –compress compress file data during the transfer
-r, –recursive recurse into directories
-l, –links copy symlinks as symlinks
-p, –perms preserve permissions
-t, –times preserve modification times
-o, –owner preserve owner (super-user only)
-g, –group preserve group
–devices preserve device files (super-user only)
–specials preserve special files
-D same as –devices –specials
–delete delete files in the destination.