Backup Synology to Unraid

The easiest way to backup a Synology NAS to Unraid Server is to use Hyper Backup on Synology and rsync on Unraid.

Click to Read More

First, enable rsync on your Unraid Server. It is preinstalled but not running as a daemon.

Create a file /boot/custom/etc/rsyncd.conf with the following content:

uid             = root
gid             = root
use chroot      = no
max connections = 4
pid file        = /var/run/rsyncd.pid
timeout         = 600

[backups]
    path = /mnt/user/backups
    comment = Backups
    read only = FALSE

Here above:

  • The name "backups" between brackets will be visible as "backup module" from the Synology. You can create several blocks like this one.
  • The "path" (here /mnt/user/backups) must exist on your Unraid server.
  • Notice: the folder /boot should exist. But you could possibly have to create the subfolders /custom/etc

 

Next, create a file /boot/custom/etc/rc.d/S20-init.rsyncd with the following content:

#!/bin/bash

if ! grep ^rsync /etc/inetd.conf > /dev/null ; then
cat <<-EOF >> /etc/inetd.conf
rsync   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/bin/rsync --daemon
EOF
read PID < /var/run/inetd.pid
kill -1 ${PID}
fi

cp /boot/custom/etc/rsyncd.conf /etc/rsyncd.conf

Finally, add the following line in the file /boot/config/go :

#!/bin/bash
bash /boot/custom/etc/rc.d/S20-init.rsyncd

 

Now, either reboot or execute: bash /boot/custom/etc/rc.d/S20-init.rsyncd

 

Go now on your Synology and open "Hyper Backup" to Create a new Data Backup Task:

Select rsync as Backup Destination:

And Create the backup Task with "rsync-compatible server" as Server Type:

45 thoughts on “Backup Synology to Unraid

  1. Thanks for this - great explanation and worked for me.
    (note to execute /boot scripts in unraid >6.8, must use "bash /boot/....." )

  2. Excellent description and how to. Thank you. I had seen something similar on other sites, but it wasn't as clear as this one.

    One question though. I rebooted my unRAID server and the /boot/custom/etc/rc.d/S20-init.rsyncd did not execute. I do have that line within the go file in /boot/config/. I needed to manually run the "bash /boot/custom/etc/rc.d/S20-init.rsyncd" command for my Synology HyperBackup to see the rsync server as online.

    • As mentioned by Danny, since unraid 6.8, one must use bash in front of the command.

      It is mentioned in the 6.8 release notes that the security of the flash drive has been tightened and files located there can no longer have execute permission. Option now available are:
      - Add the command before the script name. E.g. bash scriptname
      - copy the script elsewhere and then give them execute permissions
      - use the User Scripts plugin to run the script.

      So, in /boot/config/go, instead of :
      /boot/custom/etc/rc.d/S20-init.rsyncd
      one must use:
      bash /boot/custom/etc/rc.d/S20-init.rsyncd

  3. Thank you for posting this. Very helpful.
    I had the same situation as Matt. Do you know how to resolve this so on the next reboot the command is executed automatically as it should? Thanks

  4. Amazing guide, just one suggestion. Specify that it might be needed to create the /custom folder. I was confused as to if I had to create it or if it had to be enabled somewhere. Thanks!

  5. Hi, this looks like what I am looking for. Trialing Unraid currently. have 5 Synology boxes I have accumulated over the last 10 years and am wanting to replace 3 of them with an Unraid server.

    You lost me when you with this "Create a file /boot/custom/etc/rsyncd.conf with the following content:"

    Using the Unraid admin panel, MAIN page I have tried looking on my flash drive and storage drives and can't see a /boot directory. Where is this?

    I have another 15 days left to try and get this to work before deciding whether I buy Unraid or not. So my experience with it and Linux in general is only a mere 15 days and therefore pretty limited. A shame no one has written an app to do this as I suspect a lot of Synology users are looking for a method to get this running since Synology's powerful systems are all insanely priced. I had hoped "dmacias72" NerdPack would have had a simple check box for getting the service running.

    Thank you for your help.

  6. I'm trying to get this set up (new to unraid) and running into the following error when running the "bash /boot/custom/etc/rc.d/S20-init.rsyncd"

    /boot/custom/etc/rc.d/S20-init.rsyncd: line 2: $'\r': command not found
    /boot/custom/etc/rc.d/S20-init.rsyncd: line 11: warning: here-document at line 4 delimited by end-of-file (wanted `EOF')
    /boot/custom/etc/rc.d/S20-init.rsyncd: line 12: syntax error: unexpected end of file

    Unraid 6.8.3

        • You are new to Linux I presume ?
          You should connect on your unraid using a SSH console (I suggest "Putty" : https://www.putty.org/)
          Log into unraid (by default, I think you should be able to use the login 'root')
          Edit the file with the text editor 'nano'. Type in the SSH console: nano /boot/custom/etc/rc.d/S20-init.rsyncd
          Copy the text from my post and right-click into nano to paste it
          Press CTRL-X to save
          Press Y to confirm
          Press Enter to complete

          • Hi Valery!

            I am indeed new to linux. I'm a video editor, and trying to get an unraid server set up, to back up our main synology server. Unfortunately, because of covid, I'm having to cross function in IT as well.

            I appreciate your patience.

            I downloaded putty, and successfully logged into the server. I was also able to edit the S20-init.rsyncd properly using your instructions.

            I moved back to the unraid terminal, and executed "bash /boot/custom/etc/rc.d/S20-init.rsyncd"

            This is what I received in terminal
            root@Tower:~# bash /boot/custom/etc/rc.d/S20-init.rsyncd
            /boot/custom/etc/rc.d/S20-init.rsyncd: line 2: $'\r': command not found
            /boot/custom/etc/rc.d/S20-init.rsyncd: line 11: warning: here-document at line 4 delimited by end-of-file (wanted `EOF')
            /boot/custom/etc/rc.d/S20-init.rsyncd: line 12: syntax error: unexpected end of file

            I appreciate any additional help you could provide!

          • Yikes, I just realized that I'm received the exact same result as the original files, created in windows.

            Should I delete the files created in windows, and recreate them using putty?

          • Yes, you better have to delete the files created with Windows, using the command "rm":
            rm /boot/custom/etc/rsyncd.conf
            rm /boot/custom/etc/rc.d/S20-init.rsyncd

            Next recreate them with the text editor "nano".
            The problem is due to Windows using a "Carriage Return" (CR) + a "Line Feed" (LF) to end the lines, while *nix (linux, unix,...) are using only a "Line Feed" (LF)

            Next... if you still have the problem (weird as I did exactly the same), I could suggest another approach (a tip for you if you prefer to edit *nix files on Windows):

            Use the text editor "Notepad++" on Windows to open those files and check their encoding (via the "Encoding" menu of Notepad++).
            If it's not "ANSI", use the menu "Encoding > Convert to Ansi"
            Then, just to be 100%, use also "Edit > EOL Conversion > Unix (LF)"
            And save the files back to Unraid.

            If it still does not work (I would be lost), you can use the hard way to remove the \r with the following command in the SSh console (via Putty):

            sed -i 's/\r$//' /boot/custom/etc/rsyncd.conf
            sed -i 's/\r$//' /boot/custom/etc/rc.d/S20-init.rsyncd

          • It's working perfectly now!

            I deleted the files, and recreated them using nano, in putty, as you described above. I really appreciate your guidance through this process.

            Thank you so much for your help Valery!

  7. Hi - this is a great explanation. I'm a newbie so I am struggling with the basics:
    Assuming that it is boot on the flash drive, which I am struggling just to create the actual scripts. I get an error on not being able to create the scripts. I can't create the custom/etc directory either. How do I do that?
    Thanks!

  8. Hi, I've followed your instructions but I am unable to get the HyperBackup to connect when it searches for the 'Backup module'. I get this:

    "The operation failed. Please log in to DSM again and retry."

    - is there a way to check everything is running fine on the unRAID server for rsync?
    - is there a way to get more details from the Synology side?

    Help much appreciated.

    • Are you using DSM 6.x or 7.x (beta) ? This is a message I often have with DSM 7.x but never with 6.x.

      To be sure your Rsync Server is running fine on Unraid, check if the file /var/run/rsyncd.pid contains a valid process id (+ check it's still running via ps command)
      Next you could try to connect onto it with a Rsync Client on your PC (Windows); The easiest would be with the trial of https://acrosync.com/windows.html

      • For some reason its not creating the rsyncd.pid file. I've tried specifying a different directory for that file too but its not creating it there either. For now I am just running sync on UnRAID to copy from a share on the NAS...and I'll cron it.

  9. Hi folks. This looks like just what I need to get running to copy from my synology camera box to my unraid server. Before I create these files I wanted to be sure I understand where they need to go? I assume copied to the USB drive? I started to use Krusader and realized it points to the internal folder structure of the docker container.

    • I have everything completed and tested the server on unraid terminal and it appears to work.

      root@unraid:~# rsync rsync://192.168.1.24
      backups Backups # Modual Description

      But I can not reach it via hyper backup. It appears to find the backups rsync folder but lastly I get failed to connect to backup destination on the hyperbackup program. Any suggestions? So close! :)

      • You mention that you cannot reach the rsync service on Unraid from Hyper Backup, but Hyper Backup finds the rsync folder ?
        So... the error occurs when Hyper Backup starts the files transfer ?

  10. Hi Buddy,
    Thanks a lot. I followed the instructions as it is and everything working correctly. I cannot say how much I appreciate your efforts in making this article.

  11. I want to be able to backup my Synology NAS to unRAID using Hyper Backup from this great post which does exactly what I want to do. I don't really want to go the opposite direction which looks a bit easier. I can't get my Synology NAS to connect using the methods described in the post. The Synology shows a connection error when Hyper Back runs at the "Backup module:" and "Directory:" fields. When I run /boot/custom/etc/rc.d/S20-init.rsyncd from the unRAID command line, I get "permission denied". I have carefully checked the various entries in the post above. Not too sure how to debug this other than starting it all again from scratch... Appreciate any help that can be offered.

  12. Thanks for sharing, this worked perfectly! One question- why the need for the cp command? why not edit /etc/rsyncd.conf ?

  13. Any tips for speeding up the process? I find the network activity goes through spikes where bandwidth is pretty good 80-90MB/sec and then drops to 5-10MB/sec. I thought this could be from UNRAID data writing speeds so I set the Mover to move files from the cache disk at 50% full (500GB) and added the CA mover tuning plugin. It's faster than no cache disk and writing directly but can't get a steady stream of data going for the backup process. 26TB is taking almost a week.

    • To be honest, I am not an expert enough in rsync and unraid to investigate such perf issues... I can only confirm that Hyper Backup is also already super slow for me..., even if I can both read & write, e.g., videos of 4GB at +100MB/s (via Samba).

      Using rsync from a PC, one could test which part is the slow one: Hyper Backup or Unraid.

  14. I am planning to do this, but have a couple questions first

    Can backups be capitalized. I have a share already created called Backups so I'd like to use that if possible

    After this line - "Finally, add the following line in the file /boot/config/go" You actually have 2 lines listed. Should both lines be added or only the first. If just the first what is the second line for?

    Thank you for doing this as I'd have no clue how to do it otherwise

    • Yes, path can be capitalized. But use the correct case as Linux is case sensitive (so, both Synology and unraid).

      If the file is empty, enter both lines. If it is not, then the first line should already be there. So you will only have the add the second one.

  15. Used this guide today with Unraid 6.9.2, DSM 7.1 and Hyper Backup 3.0.2. Works like a champ! Thank you for creating this guide.

  16. Hey! Thanks for the guide first of all - used with a DSM 7.0 and Unraid 6.10-rc3 and everything seems to be working.

    Now, please excuse the the newbie question. I can see in DSM that the task is finalized and all the data is backed up. When I open the corresponding folder in Unraid, I see a Folder.hbk folder which if I open it contains a lot of files, but not the the ones that I am expecting. Basically I cannot see the actuall folders and files from DSM that I wanted synced. I am assuming this is correct, but my expectation was to have the actual files, so that in case my NAS dies, I have everything backed up and easily accessible on my Unraid.

    What am I missing in the behaviour of rsync?

    • To be honest, I didn't try myself (And I am far from my PC, being on holidays). I think this is due to the way Synology is backuping it's files.

      Try to restore some files to be sure the backup is properly done.

  17. Hey,
    Thanks for the post. I've followed the instructions and everything seems to be OK but i'm not able to finish the configuration with HyperBackup : in the first window, i'm able to reach the Unraid server and i'm able to see the "Backups" directory but when i select the directories to backup in the Hyper Backup and i click to the next button, the connection fails.
    Do you have any idea to solve the problem ?
    Thanks in advance for your help.

    Here is my configuration : Hyper Backup v3.0.2 / DSM 7.1

Leave a Reply

Your email address will not be published. Required fields are marked *