Backing up a Linux Device to a Synology NAS
Configure Synology NAS as the destination server
If you want to back up data from your Linux device to your Synology NAS, you need to enable the rsync service on the Synology NAS first before creating a backup task. To enable rsync, complete the following steps:
1. Log in to the Synology Disk Station Manager (DSM) using an account belonging to the administrators group, or assign application privileges for the rsync backup destination to a user account (Control Panel /Privileges) and log in with its credentials.
2. Open Control Panel.
3. Go to File Services /rsync, and then select the Enable rsync service checkbox.
4. Click Apply to save your settings.
To set up a DSM user with proper privileges on your Synology NAS, please do the following:
1. Go to Control Panel /Privileges, and grant the rsync privilege to the user.
2. Go to Control Panel / Shared Folder, select a shared folder, click Edit/ Permissions, and then grant the Read/Write privilege to the user. Repeat this step to include more shared folders that could be used as backup destinations.
Back up data from a Linux device to your Synology NAS
· The best way to back up data from a Linux device to Synology NAS is to use rsync to make mirrored folders. You will need to mount the folder on the Synology NAS to your Linux device using CIFS or NFS mount beforehand. The command for this is:
· [root@linuxmachine] # rsync -av [source_folder] [destination_folder] # 1. Make /home/ mirror to /backupfolder/home/ [root@ linuxmachine] # rsync -av /home /backupfolder/
· Otherwise, you can execute the below command on your Linux device without having to mount the directory. In the example below, 192.168.x.x should be replaced with the IP address of your Synology NAS. If you want to back up data to any folders other than the default folder, NetBackup should be replaced with the destination shared folder on your NAS:
# rsync -av home/ email@example.com::NetBackup/backupfolder/
· Data backups can also be encrypted by inserting -e ssh into the command:
# rsync -av -e ssh home/ firstname.lastname@example.org::NetBackup/backupdata/
· When rsync is running, it will compare the data between your Synology NAS and Linux device. Only modified files will be transferred to save time.