rsync questions


prostuff1

Recommended Posts

I have been reading through the man pages for rsync and have come to the conclusion that I can use it to backup my home folder on my Mac to my server.

 

Having said that I am trying to figure out what command line options i am going to need.  This, for me, is the hard part and why I am asking your help.

 

I want to copy everything in /Users/myhomefolder to /Volumes/Kyles\ Files/Mozy and i guess it would be best if i could do a check to see what files have changed and only update those.

 

If anyone has some insight and guidance that would be great!!

Link to comment

OK, I have been doing a lot of reading, googling, and testing on my machine and I think i may have come up with the correct set of command line options for my situation.  If any of the users here have any input on them and feel that there would be a better set or completely different set that would work better feel free to comment.

 

I am backing up /Users/myhomefolder to /Volumes/Kyles Files/Mozy/.  For the initial rsync i used this command:

rsync -avuzb /Users/kylehiltner /Volumes/Kyles\ Files/Mozy/

and this (from my understanding and what it looks to be doing) has copied my entire home folder to the Mozy.  I kinda wanted to see what was going on for the initial transfer so i added the v option in there but it is probably not necessary after that.

 

Now from there I think I am going to need to modify the command a little to get it to backup the way I want it to.  I want the rsync command to only update what needs updating.  I think the command needs to look like this but input is appreciated:

rsync -aquzb --delete /Users/kylehiltner/" & quoted form of "/Volumes/Kyles Files/Mozy/kylehiltner

 

This should look at the stuff inside the /Users/kylehiltner/ folder and copy only the things that have changed to /Volumes/Kyles Files/Mozy/kylehiltner taking into account anything that has also been deleted.

 

Hopefully I have it set up correctly and if anyone sees anything that might be off please let me know.

Link to comment

OK, for anyone wanting more information I have also created some AppleScripts to help facilitate this whole process.

 

I use a program called Locations X to help manage my connections and the different locations I have set up.  The benefit of this program is that it allows you to run AppleScripts, set a default printer, set volume, among many other things.

 

I am using this AppleScript to mount my User Shares when I connect to my home network:

tell application "Finder"
mount volume "smb://username:pasword@servername/sharename"
end tell

 

Just replace the the username, password, servername, and sharename with the required information.  Repeat the command as needed and you should be able to mount whatever you want to.

 

I also use this script that basically does an rsync:

if exists "/Volumes/sharename" then
do shell script "rsync -aquzb --delete /Users/myhomefolder/" & " " & quoted form of "/Volumes/path/to/sharename/"
else
mount volume "smb://username:password@servername/sharename"
delay 15
if exists "/Volumes/sharename" then
	do shell script "rsync -aquzb --delete /Users/myhomefolder/" & " " & quoted form of "/Volumes/path/to/sharename/"
end if
end if

This one is the one I created and seems to work.  Open "Script Editor" and paste this in, make the required changes and then save it as an application.  From there you can set up an event in iCal to run the application however often you like.  This script I am still messing with and I will update anything if I change it but I figured I should say: USE THIS SCRIPT AT YOUR OWN RISK AS I GUARANTEE NONE OF IT.  With that said it seems to work and I have not had a problem yet.

Link to comment

Hey...  I don't want you to think nobody was listening.  Though I can't apply what you learned about configuring rsync with your mac, I did take the other information you shared and configured my server to rsync the custom configuration on my flash drive to a ‘backup’ share on my array on a daily and weekly basis (2 different backup locations).  It's very handy and gives me piece 'o mind.

Link to comment

Hey...  I don't want you to think nobody was listening.  Though I can't apply what you learned about configuring rsync with your mac, I did take the other information you shared and configured my server to rsync the custom configuration on my flash drive to a ‘backup’ share on my array on a daily and weekly basis (2 different backup locations).  It's very handy and gives me piece 'o mind.

 

No worries, I like hearing myself talk anyway…

 

I figured that what I learned might come in handy for some of the other mac users on the forum.  I see that RobJ has added it to the Topical Index so that others can find it if need be.

Link to comment
  • 3 months later...

Hey...  I don't want you to think nobody was listening.  Though I can't apply what you learned about configuring rsync with your mac, I did take the other information you shared and configured my server to rsync the custom configuration on my flash drive to a ‘backup’ share on my array on a daily and weekly basis (2 different backup locations).  It's very handy and gives me piece 'o mind.

 

No worries, I like hearing myself talk anyway…

 

I figured that what I learned might come in handy for some of the other mac users on the forum.  I see that RobJ has added it to the Topical Index so that others can find it if need be.

 

Thanks for the help!  Any other insight would be VERY appreciated.  Again, I'm a linux n00b so none of this is easy for me nor am I asking you to tell me step-by-step.  Pointing me in the right direction would be help enough.  Thanks guys, appreciate the input.

Link to comment
  • 11 months later...

A much more elegant approach would be to use ssh and not have the root password in clear text. Something like 

rsync -a -H -E --progress --force --delete-after -e ssh "/Users/myhomefolder/" "root@serveraddress:/Volumes/Kyles\ Files/Mozy/"

 

after turning on remote login for rsync  and rsa keys generated and client keys added to the authorized_keys file on the destination.

 

See the following hint for explanation of the various options and more ideas:

http://www.macosxhints.com/article.php?story=20071220105635147

 

See this for configuring ssh:

http://kimmo.suominen.com/docs/ssh/

Link to comment
  • 1 year later...

There is not a lot to explain really.  The reason I did not bother with ssh is because this will only run when I connected to my home network.  Location X (or similar app you want to use) will determine that.

 

You basically need to copy and paste the above applescript text into AppleScript Editor and save it.  Once that is done you can just run it or automate it with Location X or similar.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.