How to: turn a DLink DNS-323 into a Rsync backup location

Rsync backups

*Updated Jan 21, 2021*

After purchasing a Synology DS-413J to replace my DNS-323 device, I wanted to repurpose the old NAS into a backup server.  In my mind, I pictured using a Richcopy or Robocopy scheduled task from a Windows machine to talk to the 2 devices.  As it turns out, both the NAS’s can speak the same language (linux) and there’s a handy little tool that takes a couple steps to do, but is well worth the effort if you want re-purpose a DNS-323.

DNS-323 instructions: You need Funplug!

1. Funplug instructions have been around for a while, NAS-TWEAKS has an excellent blog style article you can follow.  Here’s the cole’s notes version:

-After reformatting your DNS-323 device, download the fun_plug file and fun_plug.tgz and place them on the ‘volume_1’ share of your DNS-323.

reboot the DNS-323 connect via telnet to port 23 (no password required at this point)

-install the extra packages onto your DNS-323 (particularly, RSYNC) which is included:

rsync -av inreto.de::dns323/fun-plug/0.5/packages .
funpkg -i *.tgz
-enable root, and set a password
pwconv
passwd
login
store-passwd.sh
-enable and auto restart ssh services
cd/mnt/HD_a2/ffp/start
sh sshd.sh start
chmod a+x sshd.sh

Issue this command so you’re not just stuck with the busybox-only prompt:

usermod -s /ffp/bin/sh root
Change the default directory in ssh to something more familiar:
usermod -d /mnt/HD_a2/ root

That’s the most condensed version of Funplug I can give you guys, there’s lots of more minute details, but for now that will do to get what’s necessary: RSYNC and SSH services on the DNS-323.

2. Configuration of RSYNC requires some small knowledge of text editor vim or ‘vi’ as the busy box package has. First, SSH in with the root account, and create a new file named rsyncd.conf in the /mnt/HD_a2/ffp/etc directory:

login as: root
root@DNS323's password:
root@DNS323:/mnt/HD_a2# cd/ffp/start
root@DNS323:/mnt/HD_a2/ffp/start# sh rsyncd.sh status
rsync not running
root@DNS323:/mnt/HD_a2/ffp/start# cd ..
root@DNS323:/mnt/HD_a2/ffp# cd etc
root@DNS323:/mnt/HD_a2/ffp/etc# vi rsyncd.conf

The contents of rsyncd.conf should look like the below:

# /ffp/etc/rsyncd.conf configuration file
max connections = 2
secrets file = /ffp/etc/rsyncd.secret

use chroot = false
read only = no
list = false
strict modes = false
hosts deny = *
timeout = 600
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz 
*.mkv *.avi *.mpg *.jpg *.rar
pid file = /var/run/rsyncd.pid

[File Backups]
hosts allow = 192.168.0.1/24 #your local network IP range
read only = false
gid = backup
uid = backup
auth users = backup_user 
path = /mnt/HD_a2/Backup_directory #Path of Backup on DNS unit

I’ve highlighted the lines you’ll need to change:

hosts allow
= This is the IP Address range of your local network, the above example is for a standard Class C network, make the appropriate changes to yours. The /24 denotes the type of subnet mask you’re using. /24 pertains to a standard 255.255.255.0, this typically will fit your home network. Otherwise, here’s a cheat sheet on subnets.

auth users
= This user has to be created through the DNS-323 web server. You can stick with the standard ‘Admin’ account if you want, but for security purposes it’s a good idea to have a separate one for backup jobs.

path
= is the path on your DNS-323 of where you’re going to backup your data.

3. After saving rsyncd.conf, you’ll have to create a new file, rsyncd.secret:

root@DNS323:/mnt/HD_a2/ffp/etc# vi rsyncd.secret

Contents of rsyncd.secrets is very short as it contains the username and password of your backup user authenticated from rsynd.conf:

 #One line per user; a User ID:(colon)then password 
backup_user:password

The command is just one line, username:password. This is where you fill in the username and password created in the web interfaced of your DNS-323, and specified rsyncd.conf.

root@DNS323:/mnt/HD_a2/ffp/etc# sh /mnt/HD_a2/ffp/start/
rsyncd.sh status
rsync not running
root@DNS323:/mnt/HD_a2/ffp/etc# sh /mnt/HD_a2/ffp/start/
rsyncd.sh start
Starting /ffp/bin/rsync --daemon --config=/ffp/etc/
rsyncd.conf

you can also run

sh rsyncd.sh status

To see if the Rsync service has been started properly. I would also recommend making sure that Rsync starts up with the DNS323 on each reboot or power off

root@DNS323:/mnt/HD_a2/ffp/start# chmod a+x rsyncd.sh

Now we configure the Synology to backup to RSYNC services on the DNS323

*New Screenshots compatible with DSM 6.2.3 added Jan 21, 2021*

4. After logging into DSM, goto Hyperbackup, open the backup wizard to open a new job. Choose ‘Data backup task’

For the Backup Destination type, choose RSYNC

For the backup settings, configure the Server type as ‘rsync-compatible server’, enter in the pertinent details of your DNS323. It should look similar to the screenshot below. For port, just keep the default 873. The Backup module, make sure to use the exact same “Path” from the rsyncd.conf file.

ie. path = /mnt/HD_a2/Backup_directory

Backup module = /mnt/HD_a2

Directory = Backup_directory

After you hit, next DSM will test the connection for you. As long as you’ve configured the RSYNC on the DNS-323 and started the service, DSM should pick it up. After you choose your backup selections, make a schedule; set it and forget it.

Items to keep in mind
*Rsync is not hailed for speed!. On average RSYNC only travels at around 1.5-4MBps.

*Synology Hyperbackup cannot run simultaneous jobs. This means if you’re backing up a lot of data, it will take a while! Plan Accordingly, take offline backups to USB, whatever your use case scenario might be.

-Dexter

20 thoughts on “How to: turn a DLink DNS-323 into a Rsync backup location

  1. Thanks, this was awesome and easy!

  2. I have used your method to backup a Qnap to a DNS-323. A couple of errors in your method.

    1. The ‘secrets’ file is ‘rsyncd.secrets’ in the .conf file but your instructions say to create rsyncd.secret.

    2. The ‘pid file’ entry in the .conf file. Remove the space after the equal (“=”) sign or you will get an error.

    Outstanding problem.

    The files copied to the DNS-323 remain with owner = backup_user. This is because backup_user is not an administrator. Any idea how to fix this?

    Thanks

  3. @bolts25

    1. You are correct, this was likely a spelling mistake when trying to get the information into a useable format. It is indeed ‘rsyncd.secret’ – and has been edited in the original post

    2. My DNS323 was able to take it with the space before and after the “=” sign. Could be a different version of busybox that accepts it.

    For the Backup_user account, I had to create this account on the Web interface of my DNS323 in order to get the backups to work properly. And yes, I had to give backup_user full read/write access in order to get the rsync to function.

  4. Firstly, thanks for the guide. It had been really helpful for a complete linux newbie. Was wondering if you could help. I am at the step to start rsyncd.sh but I’ve got the following error.

    root@DNS-323:/mnt/HD_a2/ffp/etc# sh /mnt/HD_a2/ffp/start/rsyncd.sh start
    Error: Missing or wrong pid file in /ffp/etc/rsyncd.conf (expected: /ffp/var/run/rsyncd.pid)no

    Is there any way to confirm if the rsyncd.conf was done properly using vi? Thank you!

  5. great !

    After changed Secret file as mentionned on above comments,
    Work pretty fine !

    my backup between my synology and dlink 323 is good !

    Thanks mate

  6. Some fix’s:
    1. Change line in /mnt/HD_a2/ffp/etc/rsyncd.conf
    pid file = /var/run/rsyncd.pid
    to
    pid file = /ffp/var/run/rsyncd.pid
    2. While removing the space after ‘pid file =’ in the rsyncd.conf file works, a ‘better’ solution is to modify the rsyncd.sh file as follows.
    From:
    Code:

    x=$(grep ‘^pid file’ $conf_file | cut -d= -f2)
    if [ “$x” != “$pid_file” ]; then
    echo “Error: Missing or wrong pid file in $conf_file (expected: $pid_file)”
    exit 1
    fi
    To:
    Code:

    x=$(grep ‘^pid file’ $conf_file | cut -d= -f2 | sed -e ‘s/^[[:space:]]//g’)
    if [ “$x” != “$pid_file” ]; then
    echo “Error: Missing or wrong pid file in $conf_file (expected: $pid_file)”
    exit 1
    fi
    i.e. Strip leading whitespace using sed

    3. To autostart service change file permisions:
    #chmod a+x /mnt/HD_a2/ffp/start/btsync.sh

  7. Sorry …
    3. To autostart service change file permisions:
    #chmod a+x /mnt/HD_a2/ffp/start/rsyncd.sh

  8. rsyncing now DS 216+II towards DNS 323

    THX to everybody for the postings

    one additional comment:
    backup_user cannot be admin – has to be a different user
    maybe obvious for professionals – but took me as a newbie a couple of hours

  9. Hello

    I have an error message when executing the command

    rsync -av inreto.de::dns323/fun-plug/0.5/packages .
    funpkg -i *.tgz

    error message

    rsync: write failed on “/home/root/packages/automake-1.10.1-2.tgz”: No space left on device (28)
    rsync error: error in file IO (code 11) at receiver.c(322) [receiver=3.0.9]
    rsync: connection unexpectedly closed (2826 bytes received so far) [generator]
    rsync error: error in rsync protocol data stream (code 12) at io.c(605) [generator=3.0.9]

    Thank you

  10. After a reboot, rsync will not start, and the error is “/ffp/var/run/rsyncd.pid stale”. It seems the /var/run directory is not cleared after a reboot, which I believe is supposed to happen. Therefore there is a stale rsyncd.pid in it that prevents rsync from starting. Any advice, anyone?

  11. @amollerup

    You should be able to SSH into your DNS323, navigate to the /ffp/var/run directory and just delete that rsynchd.pid file out of there.

    Otherwise, just make sure your rsync files look the same as above.

  12. @Dartmania180

    Your Nas is out of space, it’s in the error:
    rsync: write failed on “/home/root/packages/automake-1.10.1-2.tgz”: No space left on device (28).

  13. I have done all of above, service starts, no errors.
    But when I create a rsync job from my Asustor NAS to the DNS-323 I get:
    “Module not found on destination rsync server.”
    Any idea why?

  14. @SirMacke
    That “Module not found on destination rsync server.” error you’re recieving – I’ve updated this post with the latest Synology DSM settings. As for the Asustor NAS, to be honest I haven’t used that brand of NAS before. I would imagine it’s looking for the portion you put into the rsyncd.conf file, the “path” variable. Have a look at that, I highlighted it in blue above

  15. Hi all,

    I also have the 216+II and DNS 323 with funplug & rsync running. The suggestions are terrific, however I have encountered this error config Backup Destination Settings; ‘

    Failed to establish the SSH connection. Please make sure that your credentials are correct, the SSH service of the destination server is normal, and the 2-step verification is not enabled before trying again’.

    Could this be something to do with new DSM 7 on the 216+II?

    1. @Ramjet. I’m not really sure. I’ve been running DSM 7 on my DS420+ for the last few weeks and backups to my DNS323 seem okay. I even have 2FA enabled for all my accounts on the 420+. That being the case, I don’t think it’s anything to do with DSM version. Check the following: if your port 22 on your DNS323 is open, the RSYNC service is running, and validate your passwords.

  16. @Dexter – Hi ! I recently purchased a DS720+ to replace my DNS-325 and would like to repurpose my DNS-325 to back up my DS720. Is rsync the best way to go ? I’ve tried Hyper Backup on the DS720 via webDAV and keep getting authentication errors (even though the 720 can read the 325 as a mounted drive, and the account I’m using on the 325 is webDAV enabled). I’m not that comfortable with fun_plug and Linux commands, so was hoping to avoid that on that route on the 325. But that being said, I would really like to find a way to use the 325. Any suggestions ?

  17. @Vacuum_Tube. Congrats on getting the DS720+, Synology makes great little devices. There’s not much more you can really do with the DNS-323/325 series NAS devices since they lack SMB 3.0 support. I think the last major firmware for these Dlink NAS devices was somewhere in 2013, and at that time they only provided SMB 1.0 support (not very secure, and slow). I chose to use rsync on this little box because it’s using busybox linux inside, and so does the Synology. Linux to linux using ssh to ssh was the only way I could make this work. I mean, if you really want to use your 325 as a backup destination, and not ‘hack’ it, you could look at a Robocopy script, a sync utility like allwaysync, or even something like Cobian backup. All those things I just mentioned do require some intermediary computer (Windows or Mac). Which, HAS to be on to initiate the backup process. If you’re not into fun_plug, there’s another alternative: ALT-F firmware. This gives a ton of extra features (like SMB 3.0), and natively supports rsync. I write about configuring Alt-F into an rsync target here too: https://www.fatdex.net/php/2021/01/23/how-to-configure-a-dns-323-alt-f-firmware-as-an-rsync-target/.
    Keep in mind, these Dlink NAS’s were originally bulit in 2007. They’re getting pretty dated; 64MB of RAM, 500MHz proc. These aren’t going to copy anything faster than 10Mb/s (megaBITS). They unfortunately limited in comparison to your Synology (which, I’m sure your reaping the benefits of now). These are only good for secondary cool storage, backup, perhaps torrenting. My only suggestion for these things are as cool storage, secondary / tertiary backup targets, or as a learning tool; use it for that linux functionality. Otherwise your Synology can easily run VM’s that would put the Dlink to shame.

  18. hello, Im close to getting this working, but running into an error:
    2022/02/09 03:21:11 [2753] rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
    2022/02/09 03:21:11 [2753] rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]
    2022/02/09 03:21:11 [2754] name lookup failed for 10.0.0.16: Name or service not known
    2022/02/09 03:21:11 [2754] connect from UNKNOWN (10.0.0.16)
    2022/02/09 03:21:11 [2754] module-list request from UNKNOWN (10.0.0.16)

    I’m trying to backup from Synology Hyper backup to the repurposed DNS-323 and it looks like it cant find the backup directory. In the Hyperbackup version I am running, I cannot specify the backup module. The system seems to want to search for it. It fails and I get the above messages.

    the backup directory config in rsyncd.conf is the following:
    path = /mnt/HD_a2/media_backups
    and this directory exists on the system:
    root@D-Link_dns-343:/mnt# cd HD_a2
    root@D-Link_dns-343:/mnt/HD_a2# ls -l
    total 16
    drwxr-xr-x 16 root root 4096 Feb 9 01:23 ffp
    -rw-r–r– 1 root root 4053 Feb 9 03:10 ffp.log
    -rwxrwxrwx 1 nobody 501 1767 Feb 8 00:24 fun_plug
    drwxrwxrwx 2 nobody 501 4096 Feb 9 00:58 media_backups

    the backup_user was created in the DNS GUI

    Any sugestions?

    thanks

Leave a Reply

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

*

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.