How to mirror one folder from one nas to another using rsync and fun_plug

A few visitors of this website requested a tutorial on how to synchronize one folder from one NAS to another one. Of course this tutorial requires fun_plug installed on your NAS.

Attention: I describe unencrypted connections ins this tutorial, for encrypted ones, please visit the online search provider of your choice with the keywords “rsync ssh”.

Attention: Existing configurations of the rsync-server are maybe overwritten. Users who changed something in this area are advised to integrate this tutorial in their configuration on their own.

Werbung


The scenario is the following: The NAS Alice contains a folder named Foo, which should be copied to the NAS Bob into the folder Bar. Changes in Foo will be copied to Bob, changes in Bar will be overwritten by the contents of Foo.

Let’s start 🙂

Download of the required files

Please execute the following steps on Alice:

cd /ffp/etc/
wget http://wolf-u.li/u/370
wget http://wolf-u.li/u/371
wget http://wolf-u.li/u/372
chmod 600 rsyncdsecretsfile

And the following ones on Bob:

mkdir -p /ffp/var/opt/uwmirrorfolderrsync/
cd /ffp/var/opt/uwmirrorfolderrsync/
wget http://wolf-u.li/u/375
wget http://wolf-u.li/u/374
chmod 600 uwmirrorfolderrsyncpass
chmod a+x uwmirrorfolderrsync.sh
cd /ffp/start/
wget http://wolf-u.li/u/376

Now all required configuration files are downloaded to the NAS.

Password

Now login to Alice and edit the file /ffp/etc/rsyncdsecretsfile. There you need to replace YOURPASSWORDHERE by a password which will later be used by Bob to authenticate against Alice. I’d use a password with 20 or more characters, but that is up to you. Now go into Bob and edit /ffp/var/opt/uwmirrorfolderrsync/uwmirrorfolderrsyncpass where you need to replace YOURSERVERPASS by the same password.

Folder

The source-folder on Alice needs to be configured now. Currently this is “/mnt/HD/HD_a2/Foo” which is probably different from your desired folder. Change this in the File /ffp/etc/rsyncd.conf.

The target-folder on Bob is currently /mnt/HD/HD_a2/Bar which can be reconfigured in /ffp/var/opt/uwmirrorfolderrsync/uwmirrorfolderrsync.sh (Variable BACKUPDIR). Change this to the desired folder on Bob

Testrun

Start the rsync-server on Alice:

sh /ffp/start/rsyncd.sh start

And run a test on Bob:

/ffp/var/opt/uwmirrorfolderrsync/uwmirrorfolderrsync.sh

Normally the first run on Bob should be ok, errors will be displayed and are most of the time more or less obvious.

Permanent Operation

If the test-runs are completed sucessfully, the rsync-server on Alice will be switched on permanentely and on Bob a cronjob is created which runs the script every day on 03:00 and 15:00. If you want different times, just edit /ffp/start/uwmirrorfolderservice.sh for your convenience.

Alice:

chmod a+x /ffp/start/rsyncd.sh

Bob:

chmod a+x /ffp/start/uwmirrorfolderservice.sh
/ffp/start/uwmirrorfolderservice.sh start

Thats it. For questions or remarks or just a “Thank you!” please leave a comment below.

13 thoughts on “How to mirror one folder from one nas to another using rsync and fun_plug”

  1. Hello,

    How to chmod/chown the ‘rsynced files’ to get access via network Share on Windows. The files are read only.

    Thanks, JF

    1. That is my site as well (wolf-u.li just holds the tutorials in german) 😉 If you want to compile it yourself, you should use the sources there. Otherwise use the compile packages at http://ffp.wolf-u.li for your convenience.

      Cheers,
      Uli

  2. Hi !
    In my home network setup, my ‘Alice’ is a DNS-325 which contains music and other files. My ‘Bob’ is a DNS-323. I’ve already got Fonz running on Alice (under Debian Squeeze) and will reinstall Debian Lenny on Bob. Do you forsee any issues installing and using your files ? I was hoping to use the remote backup software on the DNS-325, and mistakingly figured that it would work with the 323 as a remote. But, like other users commented, I don’t get beyond ‘test failed’ and am looking for another route. Thanks in advance.

  3. I tried to register on the forum but got this error: For security reasons, you must pass the remote ip to reCAPTCHA

    So, here is my q: I’m trying to move data from an existing disk from a mythbuntu box, it’s got an ext4 primary and an xfs secondary part.
    When the 320 boots with this disk as sdb, I get a red front light and a dmesg error when it tries to mount sdb1. Trying to mount sdb5 (xfs) fails with a generic error and no extra info logged.
    Has anyone tried to mount xfs and succeeded?
    I can swapon sdb4 so it looks like the red light doesn’t stop the 320 from using the disk.

  4. I’ve been having no end of troubles trying to rsync between two DNS-323 NASes and any help or suggestions would be so appreciated.

    First of all, here are the simple configurations I’m using:

    NAS 1: Rsync Server – Source
    Device: DNS-323 w/ Firmware v1.10
    Fun_plug: 0.7
    Linux: Linux DNS323 2.6.12.6-arm1 #47 Mon Nov 30 12:06:02 CST 2009 armv5tejl GNU/Linux
    Rsync: rsync version 3.0.9 protocol version 30
    rsyncd.conf:
    motd file = /ffp/etc/rsyncd.motd
    log file = /ffp/var/log/rsyncd.log
    pid file = /ffp/var/run/rsyncd.pid
    lock file = /ffp/var/run/rsyncd.lock
    uid = root
    gid = root
    max connections = 4

    [vol1]
    path = /mnt/HD_a2
    comment = Volume 1

    [vol2]
    path = /mnt/HD_b2
    comment = Volume 2

    Rsync Server Command:
    sh /ffp/start/rsyncd.sh start
    Starting /ffp/bin/rsync --daemon --ipv4 --config=/ffp/etc/rsyncd.conf

    NAS 2: Rsync Destination
    Device: DNS-323 w/ Firmware v1.10
    Fun_plug: 0.7
    Linux: Linux DNS323BU 2.6.12.6-arm1 #47 Mon Nov 30 12:06:02 CST 2009 armv5tejl GNU/Linux
    Rsync: rsync version 3.0.9 protocol version 30
    Rsync Command (from root user’s home folder /ffp/home/root):
    rsync -vvvh dns323::vol1/ffp.log .

    What seems to be happening is that the command hangs on NAS 2 with the following output and I have to CTRL-C to stop it:

    opening tcp connection to dns323 port 873
    Connected to dns323 (192.168.10.17)
    sending daemon args: --server --sender -vvvlogDtpre.isf . vol1/ffp.log
    =============================================
    = Rsync Server on DNS-323 =
    =============================================

    receiving incremental file list
    recv_file_name(ffp.log)
    received 1 names
    recv_file_list done
    get_local_name count=1 .
    recv_files(1) starting
    generator starting pid=4803
    delta-transmission enabled
    recv_generator(ffp.log,1)
    generate_files phase=1

    Here are the logs that are generated on the Rsync Server (NAS 1):

    2012/09/14 16:28:55 [16301] connect from dns323bu.raichuk.local (192.168.10.18)
    2012/09/14 22:28:55 [16301] rsync on vol1/ffp.log from dns323bu.raichuk.local (192.168.10.18)
    2012/09/14 22:28:55 [16301] building file list

    Any thoughts or suggestions would greatly be appreciated, and thank you in advance.

    1. I should also note that the same rsync command works fine from my MacBook and from another CentOS box, but it won’t work from the DNS-323.

  5. Im trying to make a backup of some shares from my qnap nas to my dlink dns-320L. the forums pointed me to FFP which i have installed but i cant seem to work out what i need to do next. i would like to use the wizard in qnap to setup the rsync to my dlink but i cant get the shares on dlink to be displayed, i have tried rsync, rtrr (and in ftp mode) but nothing seems to work.
    Any ideas? on how to get my qnap to automatically sync to shares on my dlink?
    cheers

  6. Hi

    I am trying to set up a remote replication job to copy to my new NAS.
    I downloaded the files and made password change but I get this error when I start the RSSYNC server.
    Missing or wrong pid file in /ffp/etc/rsyncd.conf (expected: /ffp/var/run/rsyncd.pid)

    Can u help please?

Leave a Reply

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