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

I have a backup script setup to copy various files from one machine to another over ssh. Both ends are using Ext4, though the receiving end is using it on a USB mass storage device (if that makes a difference). I have the problem that some, seemingly random, files are listed as being recopied every time I run the script even though they haven't been modified. I can look on the destination and the timestamp has been updated to whatever "now" was during the copy, though the file has not changed.

I found this post regarding a similar problem with rsyncing to/from NTFS, but the timestamp issue there shouldn't apply to Ext4. Just in case, I've tried both --modify-window (which didn't work) and -u which mysteriously did work.

The permissions shouldn't be a problem since my user on the sending end is the same as my user on the receiving end and I'm not specifying any sort of preservation. Here's my command line:

rsync -rvz --no-g --links --safe-links --delete-after --delete-excluded [source] [destination]

I've verified that the delete and compress options aren't messing with it by removing them temporarily; I still get the same random files that get recopied.

Here's an example listing of files that get recopied:

source (only pertinent files listed)

/home/lytithwyn/Documents/:
-rw-rw-r-- 1 lytithwyn lytithwyn   11754 2012-08-04 13:44 family birthdays.ods
-rw-rw-r-- 1 lytithwyn lytithwyn   12897 2012-08-17 09:23 youth_fund.ods

rsync output

building file list ... done
Documents/family birthdays.ods
Documents/youth_fund.ods

destination after copy (only pertinent files listed)

/mattbackup/lithboxhome/Documents/:
-rw-rw-r-- 1 lytithwyn lytithwyn   11754 Aug 17 09:49 family birthdays.ods
-rwxr-xr-x 1 lytithwyn lytithwyn   12897 Aug 17 09:49 youth_fund.ods

Like in the other post, -u fixes it but that feels like a kludge. Anyone know whats really going on? Now that I look at it, I'm not sure what's up with the random execute permissions on the destination either.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

rsync by default uses the files time stamp to detect changes.

You have two options

  1. Add -t to your rsync command to copy the timestamps along with the files
  2. Add -c to your rsync command force rsync to use the checksums of the files to detect changes rather than the time stamps.
share|improve this answer
    
I use -a which includes -t and other options that make sense for accurately replicating files and their meta-data. –  Skaperen Aug 17 '12 at 14:42
    
Thanks @rollercow. I normally use -a so I don't have to worry about this, but I was getting errors with some of the preserves in -a since my remote user isn't root. I thought I would have the same trouble with -t, but it works without a hitch. –  Matthew Aug 18 '12 at 2:27

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.