DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-10-24 06:29:44

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

rsync PC backup problems

Hi there,

after finally having successfully set up a backup from one disk to another in my dns-323 using rsync, I now want to create a scheduled backup from my PC to the NAS using cygwin rsync, as outlined in http://dns323.kood.org/howto:backup_-_pc .
I created the rsyncd.conf file and the rsyncd.secrets file in ffp/etc, the secrets file c:\cygwin\etc and the batch file, all formated correctly, user access rights set correctly and modified accordingly. The rsync deamon runs, according to the ffp.log. When I run the batch file however, only a "Current" file, a "LastBkpDate.dat" file (which is updated each time I run the batch file) and a "snapshot.log" file (which remains empty) are created on the NAS, but no backup data folder is created whatsoever...
Oh, and I also added the cygwin path to the windows environment path variable, in case. And I'm using Windows 7 64 bit, if that makes any difference...

Here are the scripts:


======================rsyncd.conf start============================

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

use chroot = false
read only = yes
list = false
strict modes = false
# Deny access to all hosts just to be on the safe side
hosts deny = *
timeout = 600
dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz
pid file = /var/run/rsyncd.pid

[PCBackup]
        comment = Primary Backup Location for PC1
        # Allow access to local hosts
        hosts allow = 192.168.1.0/24
        read only = false
        gid = users
        uid = maks
        auth users = maks
        path = /mnt/HD_a2/Backup_PC

======================rsyncd.conf end============================




======================Backup.dat start============================

@ echo off

Rem Keep Things Tidy; establish local variables
setlocal

Rem Establish name or IP Addr of DNS323
set DNS323Name=dlink-73A664

Rem Establish name of Backup folder on DNS323
set BackUpFolder=Backup_PC

set VolumeName=Volume_1

Rem Establish RSync User Name
set UserName=maks

Rem Establish RSync Name
set RSyncModuleName=PCBackup

Rem Set Source Path
Rem Back up a single directory or drive by identifying the source path as /cygdrive/c or /cygdrive/c/Users/UserName/Documents
Rem The path = /cygdrive/c/Users/UserName/Documents looks a little odd. This is Cygwin convention for defining Windows paths from within a *nix emulator
set srcpath='/cygdrive/d/_documents'

Rem Back up multiple directories by surrounding a list with single quotes (i.e., srcpath='/cygdrive/c/Users/UserName/Documents /cygdrive/c/Users/UserName/Contacts')
Rem set srcpath='/cygdrive/c/Users/UserName/Contacts /cygdrive/c/Users/UserName/Documents /cygdrive/c/Users/UserName/Favorites /cygdrive/c/Users/UserName/Pictures /cygdrive/c/Users/UserName/Videos /cygdrive/c/Users/UserName/Wav'

Rem <------------------------------------------------------------------------------------------>
Rem
Rem               No User Configuration Required Beyond This Point!
Rem
Rem <------------------------------------------------------------------------------------------>

Rem Establish DOS backup file path
set DOSBackUpPath=\\%DNS323Name%\%VolumeName%\%BackUpFolder%

Rem Establish Cygwin backup file path
set CygwinBackUpPath=//%DNS323Name%/%VolumeName%/%BackUpFolder%

Rem Using todays date establish name of backup directory
for /F "eol=; tokens=1,2,3,4* delims=/, " %%i in ('date/t') do set YYYYMMDD=%%k%%j%%i
for /F "eol=; tokens=1,2,3* delims=:, " %%i in ('time/t') do set HHMM=%%i%%j%%k
set BkpDir=%YYYYMMDD%_%HHMM%

REM Obtain date of last backup
Rem NOTE: The usebackq attribute is required; it specifies that the new semantics are in force, where a back quoted string is executed
Rem              as a command and a single quoted string is a literal string command and allows the use of double quotes to quote file names in filenameset.
for /F "usebackq tokens=*" %%i in ("%CygwinBackUpPath%/LastBkpDate.dat") do set LastBkpDir=%%i

Rem Establish rsync module name
set modulename=%UserName%@%DNS323Name%::%RSyncModuleName%/%BkpDir%

Rem Perform rsync backup
C:\Cygwin\bin\rsync.exe -arivx -z --link-dest=/%LastBkpDir% --password-file=c:\cygwin\etc\secret %srcpath% %modulename% >> %CygwinBackUpPath%/snapshot.log

Rem Save name of current backup directory; information is required next time batchfile runs
echo %BkpDir% > %DOSBackUpPath%\LastBkpDate.dat


Rem Delete shortcut to Previous Backup Directory
if exist %DOSBackUpPath%\Current.lnk C:\cygwin\bin\rm %CygwinBackUpPath%/current.lnk

Rem Change drive/directory and create shortcut to Current Backup Directory
C:\cygwin\bin\ln -s %BkpDir% %CygwinBackUpPath%/Current

Rem Clean up variables then exit
set DNS323Name=
set BackUpFolder=
set UserName=
set RSyncModuleName=
set DOSBackUpPath=
set CygwinBackUpPath=
set YYYYMMDD=
set HHMM=
set BkpDir=
set LastBkpDir=
set srcpath=
set modulename=

exit

======================Backup.dat end============================


Any idea  what I am doing wrong, or what the problem might be?

Thanks in advance,
Marek

Last edited by mtlmaks (2010-10-25 01:50:37)

Offline

 

#2 2010-10-25 20:03:49

karlrado
Member
Registered: 2009-12-07
Posts: 229

Re: rsync PC backup problems

--link-dest=/%LastBkpDir%

looks suspicious to me.  Try removing the '/'?

Otherwise, I would add echo commands to output variable names in that Windows script to make sure they area set to what you think they are set to.

Try turning up the verbosity/debug info in the rsync command.

Perhaps try running the steps in the Windows script manually from the command line to see if you can see anything wrong.


DNS-323 FW 1.07 : 2 1TB WD Caviar Green SATA : fun_plug: utelnet + optware (no ffp)

Offline

 

#3 2010-10-28 05:27:08

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

Re: rsync PC backup problems

Hi,

thanks for your suggestions.
I added some debug steps to the process, and it appears that there's a problem with accessing the cygwin secrets file:

===============================================================================
C:\Cygwin\bin\rsync.exe -arivx -z --link-dest=/2010-10-27_2157  --password-file=/cygdrive/c/cygwin/etc/secret '/cygdrive/C/Users/john/Documents/' john@DLINK-73A664::PCBackup/2010-10-27_2202  1>>//DLINK-73A664/Volume_1/Backup_PC/snapshot.log
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module PCBackup
rsync error: error starting client-server protocol (code 5) at /home/lapo/packaging/rsync-3.0.7-1/src/rsync-3.0.7/main.c(1506) [sender=3.0.7]
===============================================================================

"password file must not be other-accessible" looks like a permission problem. I played with permissions, denying acces to anyone but me, but that gave me permission errors which lead to the same problem. Whenever I enter the password manually in the command window upon the request, i get the auth failed error (when I type the password in the command windows nothing actually shows, don't know if his is normal...). Anyone knows how to solve the problem with the secret file in the cygwin\etc folder? Thanks in advance!

Offline

 

#4 2010-10-28 17:27:42

karlrado
Member
Registered: 2009-12-07
Posts: 229

Re: rsync PC backup problems

http://justinsomnia.org/2007/02/how-to- … ing-rsync/

and a google serach on "rsync password file windows"  may help.

What is curious is that it still did not work when it gave up on the local (Windows) secret file and you typed in the password.  Did you change the permissions of the secrets file on the DNS-323 correctly?


DNS-323 FW 1.07 : 2 1TB WD Caviar Green SATA : fun_plug: utelnet + optware (no ffp)

Offline

 

#5 2010-11-01 23:08:01

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

Re: rsync PC backup problems

Hi,

after days of fiddling with the authentication problem, I gave up on that.
I went another route, using SSH, and have finally a successful windows-to-NAS timemachine (snapshot) backup running! smile
I gathered the information that I needed from lots of different sources. I think about maybe writing a tutorial about my particular setup (if I have the time), for others who might be in the same situation, and possibly also for me, to remember the steps that I did... wink Let me know if there's any interest. smile

Offline

 

#6 2010-11-29 21:17:32

ahughes
Member
Registered: 2009-02-25
Posts: 35

Re: rsync PC backup problems

mtlmaks, I've also run up against the authentication problem and would be very interested in how you got everything working. A tutorial would be great, thanks!

AH

Offline

 

#7 2010-12-17 00:26:54

Gregor71
New member
Registered: 2010-12-17
Posts: 1

Re: rsync PC backup problems

I had the same permission issues.

Look at your source files via cygwin (ls -l).  My directory permissions were crazy:  "d---------", instead of a typical "drwxr-xr-x".  Some of my files were owned by "??????????".

I fixed my issues by specifically granting my Windows user with access to the source (PC) folder (recursively).  This cleaned up the permissions/ownership for cygwin.  rsync was then able to function properly.

A different mix of rsync options might have solved this as well.  The -a option is asking rsync to preserve permissions (among other things).  This was causing my target (DNS-323) directories to be created with "d---------", causing the permissions errors.  Simply removing "-a" wasn't enough, though.


Also, the "Current" symbolic link isn't really getting created properly, but that's just a convenience anyhow.  I removed it.

Hope this helps someone
--Greg

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB