Home Engidea Home Circle

Raidsonic ICY BOX NAS4220B rsync

In this article I wish to explain the many benefits of having an rsync server on your NAS
Of course you need a NAS that actually has one or that can have one. I am working with firmware 20.11.2008 Vers. 2.6.3.1

I have found Raidsonic ICY BOX NAS4220B to be stylish, quiet, cheap and having a tweakable Linux and so I bought one and then another one to do some playing around. (No, they are not paying me for this article)

Why have a local NAS to backup your data

Before going on the technical side, let me just point out why it is a good idea to have a NAS to backup your data and not use one of the online services (you may wish to use both)

Yes, you may use both online and local storage, but having only the online backup is just risky

Why using rsync

The NAS has by its own various means of uploading and downloading files. They work very well if you are "always connected" and use them constantly. I found out that I use the NAS mostly as backup server and I have a working copy on my laptop.

With Rsync I can keep in sync my working copy with the NAS storage without remembering which file I have added or deleted. Note that rsync is mostly a one way sync tool. You tell to the command the direction of the sync and it does it, it is not really a two way sync tool.

If you need a "collaborative" space I would suggest using Subversion and its Tortoise (for Windows)TOrtoiseSVN logo integration with the system, that is the way to go if you have multiple people "sharing" a single repository, but this is another story.

What you need to get going

So, the aim is to have a rsync server running on the NAS4220 that will allow us to sync some "local" directory to the NAS. The steps to reach this goal are a few.

Gather the pieces you need to work

To be able to install anything on the NAS you need to actually reach into it, meaning that you should be able to connect to it using some sort of console and give commands. The latest revision of the NAS software does NOT come with a ssh server on its own, but you can download one from raidsonic. You have to search for 4220 and then Samplepackages (SSH and Streamripper)

NOTE: The above server only works with the latest firmware, "20.11.2008 Vers. 2.6.3.1 modified version to use self-created applications from board version 1.2" and also what I am writing is for the above firmware !

After the install (follow the instructions) you have to restart, enable the SSH service using the web console and you will finally be able to login into your NAS using the root and the password of the admin user (you MUST change that).

The subtle art of crosscompiling

Now that you can reach the NAS you need a way to compile rsync. If you are puzzled about the complexity of this let me give a brief explanation.

First of all there is NO compiler on the NAS (and this is correct) so you cannot just get the rsync source on there, compile it and run. You cannot do that.

If you compile rsync with tyou Ubuntu x86 machine the result will be for processor that is NOT the one on the NAS and so your compiled code will not run at all.

What you need is a compiler that runs on your Ubuntu but produces code for a different processor where it is running. But this is not enough, it also need to know what libraries to link and what header files to use !

Some of this is complicated by the fact that some configuration tools want to run some small "programs" to find out if a given capability is supported or not. This is the reason for people trying to do crosscompilation within a virtual machine (but then you need to make sure that the virtual machine is very, very similar to the actual machine)

Download and unpack the crosscompiler

You can download a crosscompiler from raidsonic (look for NAS4220 Sources V2.6.3) or you can have a look at the NAS-4220 community. What follows is based on the downloaded sources from Raidsonic.

WARNING: From now on you MUST untar the various pieces in the same place as I did if you want the script I am giving you to work.

Unzip the files and you should end up with a bunch of tar, one is named 920t_le.tgz. The idea is that you unpack that into /home/fornas/develop/dev-e and you also untar the usr.tgz (to have the include files)

Download and compile rsync

Downloading rsync source is easy (look at the top of the page for the main rsync web) the difficult part is setting up the build and compile stage to work. I have made a script that sets the "correct" variables and I am sharing it with you

#!/bin/sh

COMPBASE=/home/fornas/develop/dev-e/usr/local/920t_le/bin	;export COMPBASE
HOSTBASE=arm_920t_le						;export HOSTBASE

LDSHARED=${COMPBASE}/${HOSTBASE}-gcc 			;export LDSHARED
CXX=${COMPBASE}/${HOSTBASE}-g++ 			;export CXX
CC=${COMPBASE}/${HOSTBASE}-gcc 				;export CC
AR=${COMPBASE}/${HOSTBASE}-ar 				;export AR
RANLIB=${COMPBASE}/${HOSTBASE}-ranlib 			;export RANLIB
CFLAGS="-I/home/fornas/develop/dev-e/usr/include -O2"	;export CFLAGS

./configure --host=arm-linux
make

Now you understand why you should unpack the pieces exactly in the right place !
You should just call this script build.sh and then run it. With a bit of luck the configure process will work and at the end you will be left with a running rsync !

A running copy for you

If you wish this is the rsync copy that I am using on my NAS, use at your own risk !
I cannot make ANY guarantee about it ! Download rsync for NAS4220 Note that the name is rsync.bin so I can easily tag it but the real name is just rsync.

A brief primer of rsync

Using rsync can be challenging, the number of available options is, let's say, big. What I write here is a getting started, from then onward, have fun !

rsync server

What I have done is to write a script to start rsync, use it for your baseline

#!/bin/sh

# you can call this file start-rsynd.sh and have the configu file in this directory

./rsync --daemon --config=rsyncd.conf &

This is a simple configu file

uid = root
gid = root

[backup]
    path = /mnt/md1/backup
    comment = Users Backup Area 2
	read only = no
	hosts allow = 10.0.0.13

Using rsync client

I assume here that you start the rsync server on the remote machine that we may call 192.168.1.10 and with the above config. The first command you wish to give is one that shows the "shares" available remotely

rsync rsync://192.168.1.10

The above should show you the backup share, if it is not then check that you actually started the server.
If you want to list the content of one "share" you can use

rsync rsync://192.168.1.10/backup

The final command, one that sync a directory to the remote share, in the command "adirectory" is the directory you wish to backup.

rsync --archive adirectory rsync://192.168.1.10/backup

If you want some feedback of what is happening you can use

rsync --archive --progress -v adirectory rsync://192.168.1.10/backup

This is it, for further commands you can look at the official rsync website !

If you want to leave a message just write it down here.
If you wish me to write back leave some contact information

   

Last update 07/02/2009