Sunday 9 September 2012

using rsync to backup local folder to D-Link DNS-320 sharecenter

We recently bought a unit of D-Link ShareCenter DNS-320 to backup our works... what else for office use? We tried using the web interface, which is good for manual backup. When we say manual, user manually select which folder/file to upload for backup. When you upload a folder, the system will copy all the files regardless some of the files are already on DSN-320 in latest version. It will just overwrite it with the same old version.. I mean, no version control. It is time consuming when I try to backup a folder with huge files inside, let says email .pst files which are normally around 2gb (for two months emails). so the solution is 'rsync' . quoting from wikipedia - rsync is a software application and network protocol for Unix-like systems with ports to Windows that synchronizes files and directories from one location to another while minimizing data transfer by using delta encoding when appropriate. Quoting the official website: "rsync is a file transfer program for Unix systems. rsync uses the 'rsync algorithm' which provides a very fast method for bringing remote files into sync."

rsync command can be issued in following manner for syncing (backup) to a remote host.
 #rsync -options localfolder username@remotehost:/remotefolder

for our case;

#rsync -avrR /data/mycloud/work     fileadmin@10.20.103.10:Volume_1/mycloudsync

this will upload (sync, backup) everything under /data/mycload/work to Volumne_1/mycloudsync on remote host 10.20.103.10, preserving the whole directory. on remote host, they will be stored in Volume_1/mycloudsync/data/mycloud/work. Output of the command is, for example;

[shariff@southasia ~]$ rsync -avrR /data/mycloud/work fileadmin@10.20.103.10:Volume_1/mycloudsync
fileadmin@10.20.103.10's password:
sending incremental file list

sent 95460 bytes  received 342 bytes  27372.00 bytes/sec
total size is 902006790  speedup is 9415.32

no files are uploaded to remote host since all files are already in sync.

Make sure there is no "/" before remote directory "Volume_1". Volume_1 is the highest level directory, so normally putting "/" should be no issue, but it is not with DNS-320. There was no documentation on using rsync as far as I know provided by D-Link, mentioning about that single "/". Below is command output when you place "/" before Volume_1.

[shariff@southasia ~]$ rsync -avrR /data/mycloud/work fileadmin@10.20.103.10:/Volume_1/mycloudsync
fileadmin@10.20.103.10's password:
sending incremental file list
rsync: mkdir "/Volume_1/mycloudsync" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(582) [Receiver=3.0.7]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.8]
[shariff@southasia ~]$

Basically, I was stuck for long time with this issue until I tried one by one placing and removing "/" where ever possible.

hope this help someone.