-   Linux - Newbie (
-   -   Need help with rsync + NAS local Folder (

khandu 07-24-2011 03:50 AM

Need help with rsync + NAS local Folder
Hey Guys

So I am trying to setup a local rsync so that

It syncs with the picture folder on the local folder to the picture folder on /Volumes/pics

now i want it to do is

1) Mount the /volumes/pics if not mounted (ip address with auth), so that if I am not on the network / IP does not work it will not execute.
2) Do a rsync or somthing like that to sync between the two folders (with best options to do so)
3) if / when done.. umount the disk

and probably run it as a cronjob??

doing it on the rsync command on a mac..

plz help if any one has experience..

My main aim is to keep an active backup of the folder on my local NAS and keep it sycned.. any other method to do it from my mac to NAS will be helpful.. I know this is linux forum.. but i thought rsync command is linux based so can help

sysfce2 07-24-2011 11:53 PM

Here's one I typically use:

rsync --verbose --progress --stats --compress --rsh=/usr/bin/ssh --recursive --times --perms --owner --group [--delete] /sourcedir/*
Careful if you add in the --delete option. Definitely check out the man page for these to tweak it to your requirements (particularly if you want to add incremental backup or your login name configurations).

This is a good start too, but google is your friend.

khandu 07-31-2011 10:30 PM

Ok.. I m officially stuck :)

So I am trying to create a cronjob to sync a folder called pics to my NAS drive called temp (this is all for testing purpose)

What I have done is

1) Created a pub key of my Mac machine and transferred it to my NAS drive. So that I can do a rsync directly without a password --- done and working

2) I tried the command


/usr/local/bin/rsync -v pics/ root@
Using a compiled version of 3.0.8 rsync on Mac OSX (and therefore the path).The IP (eg) is my NAS drive. pics/ is my local folder on machine

Now it works great the first time.. but then say I delete some pics from my temp folder and then run the command again , it does not copy the missing files from pics to temp.. pics is going to my MAIN source all the time.

What I want to do is

1) Sync pics to temp
2) If files deleted from temp , next sync, they come back from pics.
3) If files deleted from pics, next sync, say move all those deleted files from temp to a new folder called say temp/deleted/DATESTAMP/ where datestamp is going to be the date of sync/delete (for record purpose).

Then I can keep checking deleted folder and manually move those files. The last step is not necessary if not possible or hard to implement.

Can u help me set up that kinda rsync command.

All times are GMT -5. The time now is 01:52 PM.