Permissions causing full backups?

Link McGinnis link2 at cschristian.com
Tue May 2 19:33:55 GMT 2006


Matt,

I've not gotten very far with the new instructions.  Hopefully, you can push
me over the hump.

Here's where I stand:
* Created a Linux share at /samba/bkups.  Within this share I've created a
directory called "link" that will hold the backup of my PC's "My Documents"
folder.  Each user will have a directory under "bkups".

* I placed your instant-daemon.sh script in /samba and ran it from there.
It created the scripts "start" and "stop" and the rsyncd.conf file.

* I edited the rsyncd.conf file.  Currently:
log file = rsyncd.log
pid file = rsyncd.pid
port = 3141
use chroot = no

[bkups]
        path = /samba/bkups
        read only = false
        auth users = link
        secrets file = bkups.secrets

* From within cygwin, I ran /bin/rsync_start.sh to start rsync:
bkup_ip=192.168.1.111
user=`echo $USERNAME | tr [:upper:] [:lower:]`
source="/cygdrive/c/Documents and Settings/$USERNAME/My Documents/My Music/"
dest=$user@$bkup_ip::bkups/
rsync -rltgoDvz "$source" "$dest"

And the result:
$ ./rsync_start.sh
rsync: failed to connect to 192.168.1.111: Connection timed out (116)
rsync error: error in socket IO (code 10) at
/home/lapo/packaging/tmp/rsync-2.6.6/clientserver.c(98)

Obvious question:  What caused the timout?  If I try the rsync with only one
":" in the destination, I get a successful copy but the files are copied to
/home/link/bkups.    

2nd question:  How can I know that my rsync is communicating with the daemon
on the samba server?  The daemon is supposed to be listening on port 3141
but I haven't told the rsync to "push" to that port. Right?

Thanks,

Link

Cedar Springs Christian Stores
504 N. Peters Rd
Knoxville, TN 37931
865-246-2042 x225
 
> -----Original Message-----
> From: Matt McCutchen [mailto:hashproduct at gmail.com] On Behalf Of Matt
> McCutchen
> Sent: Saturday, April 29, 2006 5:25 PM
> To: link2 at cschristian.com
> Cc: rsync at lists.samba.org
> Subject: RE: Permissions causing full backups?
> 
> Link,
> 
> I discovered a way that you can have your Windows machine push to an
> rsync daemon and still have rsnapshot manage the backups so you don't
> have to mess around with backup numbers and link-dest yourself.  In
> short, give the daemon a "post-xfer exec" that invokes rsnapshot.  (CC
> to the rsync list because others might wish to use this setup.)
> 
> Setting this up requires some fiddling and testing on the Linux server.
> First, add a post-xfer exec line to call a script ./kick-rsnapshot, like
> this:
> 
> [bkups]
>         path = bkups
>         read only = false
>         auth users = <all the users>
>         secrets file = bkups.secrets
>         post-xfer exec = ./kick-rsnapshot
> 
> Then, create the following kick-rsnapshot script and make it executable:
> 
> #!/bin/bash
> if [ "$RSYNC_EXIT_STATUS" == "0" ]; then
>         rsnapshot -c rsnapshot.conf occasional
> fi
> 
> Note that rsnapshot is only called if the push is successful.  If the
> push gets interrupted, you can just keep trying, and rsnapshot will
> store the backup when you eventually succeed.  If "file is vanished" is
> a problem, you can change the if:
> 
> if [ "$RSYNC_EXIT_STATUS" == "0" ] || [ "$RSYNC_EXIT_STATUS" == "24" ];
> then
> 
> Now, write the configuration file rsnapshot.conf.  If your system has
> a /etc/rsnapshot.conf.default, you may wish to copy it to the daemon's
> directory and edit from there.
> 
> Choose a snapshot root inside the daemon directory, _different_ from the
> module directory.  The default log and lock files are in system-wide
> areas; either change them to be inside the daemon directory or comment
> them out.  Set up a single backup interval; I used "occasional".
> Finally, create a single backup entry as follows:
> 
> backup  /path/to/daemon/bkups/   ./      rsync_long_args=--link-
> dest=../../bkups/
> 
> This entry copies the module contents into the snapshot.  Since the
> module is also specified as a link-dest directory, all files except
> directories get hard-linked.
> 
> Now test the setup by pushing to the rsync daemon.  Since the backup
> management is done on the Linux server, the command on Cygwin is a
> one-liner:
> 
> rsync <options> /cygdrive/c/Documents and Settings/$USERNAME/My
> Documents/My Music/ $user@$bkup_ip::bkups/
> 
> (Note the double colon, w
> 
> Rsync on cygwin connects directly to the rsync daemon and uploads the
> files to the module.  Then the daemon tells rsnapshot on the Linux
> server to convert the module to a snapshot.  Check to see whether an
> occasional.0 with the user's files has appeared on the Linux server.
> 
> As long as a file remains unchanged, its appearances in the module and
> in all the snapshots will be hard-linked together.  When the source file
> changes, the rsync daemon writes a new destination file and moves it
> over the old hard-linked one, so old backups are not corrupted.
> 
> So that's how you would accommodate a single user, but you have multiple
> users.  Give each user his/her own module.  You can put all the
> usernames and passwords in the same secrets file and mention that file
> once at the top; you can also move the "read only" and "post-xfer exec"
> lines to the top.  Then, give each module a separate "auth users" line
> naming just the user who will be pushing to the module.
> 
> I'm guessing only one user pushes at a time, and each push creates a
> snapshot.  Do you want each snapshot to contain (a) the data for all
> users or (b) just the user who pushed?  For (a), simply add a separate
> "backup" entry for each module to rsnapshot.conf.
> 
> I think (b) makes more sense, but it takes more work.  You need a
> separate rsnapshot installation for each user with its own configuration
> file and snapshot root, and then you should make kick-rsnapshot examine
> $RSYNC_MODULE_NAME and/or $RSYNC_USER_NAME to determine which rsnapshot
> installation to kick.
> 
> If you want to change an rsnapshot setting, you shouldn't have to modify
> each configuration file separately.  You might want to write a template
> configuration file with placeholders like USER.  Then you can do
> something like this in kick-rsnapshot:
> 
> sed -e "s/USER/$RSYNC_USER_NAME/g" rsnapshot.conf.template | rsnapshot -c
> /dev/stdin occasional
> 
> Devious, isn't it?
> 
> By the way, rsnapshot doesn't seem to like my version of cp.  rsnapshot
> calls "cp -al occasional.0/ occasional.1/", but cp refuses to create a
> destination directory named with a trailing slash.  If you have this
> problem, write a script "mycp" that removes the slash (below) and
> specify it as cmd_cp in rsnapshot.conf.
> 
> #!/bin/bash
> /bin/cp -al $2 ${3%/}
> 
> > Do I run this on the samba server at startup so that it's running all
> of the time?  Or, am I supposed to start it each time I want to make a
> backup?  It seems to need to be attended (supply password).
> 
> Have the daemon start (call ./start) when the system starts and stop
> (call ./stop) when the system shuts down.  The Windows user pushing her
> files does need to enter her rsync password, or she can store it in a
> file and give rsync --password-file=<file>.
> 
> I realize this setup procedure is complicated, but I think the resulting
> system will work well.  If you need help carrying it out, perhaps we
> could go on AIM (mattmccutchen) or I could SSH onto your machine and
> guide you in the ytalk shell.  Enjoy!
> 
> -- Matt McCutchen
> 
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.5.1/327 - Release Date: 4/28/2006
> 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 5/1/2006
 



More information about the rsync mailing list