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 try to synchronize files between two machines using rsync, but it seems to copy all the files regardless file modification time. Two consecutive call of the command produces the same results, so it is clearly broken.

The command in question is:

rsync -r local/path user@host:/remote/path -v

The local file system is ext4 while the remote is ext3. I suspect the issue lies here, as I had similar problems when I tried to synchronize files between the same ext3 system and an NTFS drive. Converting the latter to ext3 solved the problem.

I cannot resort to conversion this time. Does anyone know the exact source of the problem and any possible solution?

share|improve this question
    
Can you provide the complete command you're using? –  Joel E Salas Jan 6 '13 at 1:57
    
@JoelESalas I added it to the question. –  Joó Ádám Jan 6 '13 at 2:00

1 Answer 1

up vote 6 down vote accepted

rsync by default does not copy files based on their modification time and size.

If you are not using -t in the command line, rsync will not preserve the modification times and the size + time check will of course fail.

There is also a good chance that the timestamp precision of your differing filesystems is causing the problem - ext4 supports microseconds while ext3 is limited to seconds.

Try adding a --modify-window=1 to the command line, to tell rsync to treat the timestamps with one second precision.

Alternatively you can give it a -c to force checksumming of the files, but this will be of course much slower than the mtime + size check, even if it does save you the bandwidth.

share|improve this answer
1  
It was the lack of the -t switch… -c worked as well, of course. Thank you. –  Joó Ádám Jan 6 '13 at 2:15
    
Careful, though: Even with the modify window set, files will be fully synchronized twice a year due to DST changes. –  Glutanimate Jan 6 '13 at 6:11

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.