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.

My goal: given a list of files on local server, show any differences to the files with the same absolute path on remote server; e.g. compare local /etc/init.d/apache to same file on remote server.

"Difference" for me means different checksum. I don't care about file modification times. I also do not want to sync the files (yet); only show the diffs.

I have rsync 3.0.6 on both local and remote servers, which should be able to do what I want. However, it is claiming that local and remote files, even with identical checksums, are still different.

Here's the command line:

$ rsync --dry-run -avi --checksum --files-from=/home/me/test.txt --rsync-path="cd / && rsync" / me@remote:/

where:

  • "me" = my username; "remote" = remote server hostname
  • current working directory is '/'
  • test.txt contains one line reading "/etc/init.d/apache"
  • OS: Linux 2.6.9

Running cksum on /etc/init.d/apache on both servers yields the same result. The files are the same.

However, rsync output is:

me@remote's password: 
building file list ... done
.d..t...... etc/
cd+++++++++ etc/init.d/
<f+++++++++ etc/init.d/apache

sent 93 bytes  received 21 bytes  20.73 bytes/sec
total size is 2374  speedup is 20.82 (DRY RUN)

The output codes (see http://www.samba.org/ftp/rsync/rsync.html) mean that rsync thinks

  • /etc is identical except for mod time
  • /etc/init.d needs to be changed
  • /etc/init.d/apache will be sent to the remote server

I don't understand how, with --checksum option, and the files having identical checksums, that rsync should think they're different. (I've tried with other files having identical mod times, and those files are not flagged as different.)

I did run this in /, and made sure (AFAIK) that it's run remotely in /, so even relative pathnames will still be correct.

I ran rsync with -avvvi for more debug info, but saw nothing remarkable.

I'm wondering:

  • is rsync still looking at file mod times, even with --checksum?
  • am I somehow not setting up the path(s) right?
  • what am I doing wrong?
share|improve this question

3 Answers 3

Since "-a" is equivalent to "-rlptgoD" then yes it's still looking at mod times (the "-t").

Try replacing the "-a" with "-rlpgoD" and see how that goes.

share|improve this answer

it could be a permissions problem. does "me@remote" have permission to read /etc/init.d/apache on the remote server?

you might need to use the --fake-super option on either the remote rsync or the local rsync or both.

share|improve this answer

the directory have different create/modify/access times, owners or permission... dont use the -a option and try just -r

good luck

share|improve this answer

Your Answer

 
discard

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