My 1TB music collection was hosted on my main computer which also acts as a NAS, that is ok, but it’s power consumption is around 100 Watts.  My ASUS router runs at about 14 Watts and has to be on 24/7, so I bought a 2TB USB drive to store, share and play music from.

There are some complicated scripts online for backup between routers with rsync, but if you just want basic syncing to your router then this is how I did it:

This requires a Router with ASUSWRT installed, I have the RT-AC56U.

This guide presumes you already have a folder called ‘Music’ created on the USB drive plugged into the router and your router’s local IP is 192.168.1.1.

STEP 1 (Install Optware):

  • Logon to the web interface of your router
  • On the Administration page turn on SSH, and turn on JFFS
  • On the USB Application page install the Download Manager, this can immediately be uninstalled, it is just needed to install Optware.

STEP 2 (Install RSync):

Using Putty log in into the router, on the command line type:

ipkg-opt install rsync

STEP 3 (Create and Edit Config Scripts):

Download the portable version of WinSCP, run WinSCP.exe and log into your router in SCP mode.

Browse to \opt\etc\default, and edit the rsync file

Change the following options to match:

RSYNC_ENABLE=true
RSYNC_OPTS='--address=192.168.1.1'
Save changes, go back to \opt\etc\ folder, edit rsyncd.conf:
rsyncd.conf
#
configure according to your needs
uid = admin
gid = admin
use chroot = yes
max connections = 5
yslog facility = local3
pid file = /var/run/rsyncd.pid
secrets file = /opt/etc/rsyncd.secrets
strict modes = false
[backup]
path = /share/hdd/data/backup
comment = nslu2 backup
read only = no
auth users = harry
hosts allow = 192.168.10.10
hosts deny = *
[Music]

path = /tmp/mnt/HHDRIVE/Music
comment = Music Rsync
read only = no
auth users = music

Save changes, go back to \opt\etc\ folder, edit rsync.secrets, add your username:password

music:music

STEP 4 (Start RSync Daemon)

UPDATE: I have removed references to editing the .asusrouter file, as this does not work on the latest firmware, a script is created that is run after the hard drive has mounted.

To start the RSync daemon you need to create a startup script

In WinSCP browse to /jffs/scripts/

create a file called post-mount, add the following:

!/bin/sh
sh /opt/S57rsyncd.1 start

This script needs to be made executable, open Putty, log into the router, execut the following command:

chmod a+rx /jffs/scripts/*

To start rsync daemon straight away, type the command:

sh /jffs/scripts/post-mount

check the daemon is running, type:

ps | grep rsync

You should get:

2502 rewsteruk 2424 S /opt/bin/rsync --daemon --address=192.168.1.1

Step 5 (OPTIONAL – Allow external access to RSync on router)

By default RSync on the router is only accessible internally, to allow access externally do the following:

Add a Port Forward of Port 873 to 192.168.1.1

Add the following text to the .asusrouter added in step 4:

Add Firewall Rule to access Rsync on Router
iptables -I INPUT -j ACCEPT -p tcp --dport 873

This is the rsync command I use to sync my music to the router:

rsync.exe "-rltv" "--progress" "--hard-links" "--delete" "--ignore-errors" "--force" "--no-whole-file" "--link-dest=." "--exclude=/cygdrive" "--exclude=/proc" "/cygdrive/Z/ServerFolders/Music/" "rsync://192.168.1.1/Music"

DD-WRT Server Backup
Retry RSync on Connection Errors