Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a linux box that has a Windows 7 share mounted. The Linux box has a cron job to copy the contents of the Win7 share to another location on the Linux box -- a backup.

The script run is simply rsync -a etc....

I have another Linux box outside the LAN that runs the same rsync command between the Linux box in the LAN back to the Linux box outside the LAN -- a second backup.

The problem is that the rsync command doesn't seem to update files that have changed since the last run of rsync. I have a file that I know has changed on the Windows box that, on the Linux boxes, is still an old version. I'm wondering if the rsync command looks at the folder's time stamp and if there is no change, skips the whole directory. Or perhaps something else is going on?

Why doesn't rsync updated files with new timestamps?

Thanks

EDIT -- to add more details:

The command I run is this:

rsync --ignore-existing --delete --stats --progress -a /hqserver/ /company_data/HQ_Backups/Day

My setup:

In the LAN there is a Windows 7 machine that holds the company data. User work off of this share from their computers. There is a Linux box in the LAN that uses samba to mount this same Windows 7 share and rsyncs the share contents to another location on the Linux box. Then there is another Linux box outside the LAN that runs the same rsync command to copy the internal Linux box contents to itself.

The cron job runs the command as root. Here's the crontab:

00 2    * * *   root    python /home/garfonzo/Backup_Scripts/BU_Script.py

The BU_Script.py contains the rsync command.

Here's the ls of the folder the backups are sent to:

drwxrwxrwx  9 garfonzo garfonzo 4096 2011-12-03 02:00 HQ_Backups/

EDIT 2

Whoa whoa whoa... is the --ignore-existing flag the root of my problem!?

share|improve this question
    
Does increasing rsync verbosity via '-v' give any hint? –  S19N Jan 6 '12 at 23:01
add comment

2 Answers

up vote 1 down vote accepted

Obviously the problem is in the --ignore-existing option, which means "skip updating files that exist on receiver" (as per man rsync(1)). Remove the option and everything should work as you expect.

You could also consider using rdiff-backup (http://www.nongnu.org/rdiff-backup/) to have incremental backups.

share|improve this answer
    
Ya... I kind of feel ridiculous that I didn't think of the --ignore-existing flag. It only struck me when I posted the command here. Thanks. –  Garfonzo Jan 6 '12 at 23:28
add comment

can you include the complete, exact rsync command you're running (both of them)? rsync has a couple of options (--ignore-times and --size-only) that could cause files not to transfer, but it sounds like you're not using those. Also, more details about your file sharing setup: are you using Samba? does the cronjob run as root? are the files owned by root on either of the Linux machines? what do the permissions look like?

to see what's going on, run your script manually and add "-vv" and "--progress" to see what's being skipped and why.

share|improve this answer
    
I've added the -vv and --progress to the script and ran it again (I know for a fact the SOME of the files have changed). Every file indicated simply says exists. –  Garfonzo Jan 6 '12 at 23:20
    
try once more with -vvv on just a file you know has changed - don't do the whole dir, do just that file. If it still doesn't copy, double check that the file really did change - how do you know it changed? what changed about it? did you change it on the Windows side or the Linux side? Go change it again by hand, and compare ls(1) output of the file from the Linux side before and after the change - maybe the change you're making isn't propagating through Samba properly? –  darkuncle Jan 7 '12 at 0:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.