LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-20-2012, 04:07 AM   #1
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Rep: Reputation: 35
rsync minor glitch


I always use rsync to sync files on a portable drive and the internal drive.

Usually I create or download files to the portable drive and then
use rsync to help to sync the two drives.

Imagine I connect the portable drive to a linux system for the first time,
work on the data, and
then I sync the data, then disconnect it from the linux system since I need to shutdown the
machine.

Upon reboot, I connect the portable drive to linux again and then do rsync
just to make sure that no files need to synced.

However, I find that from time to time that the time stamp of the identical files on the portable drive and that on the internal drive
changes by just a little bit and this upsets rsync and trigger it to sync
it again.

Luckily, the time stamp will not change upon the second rysync.
Else rsync is going to work very hard as I accumulate more and more data
on the internal drive.

The following shows a typical change:

Quote:
% ls --full-time external-drive/A.pdf
-rwxr-xr-x 1 user user 1773350 2012-05-19 17:14:38.000000000 +0800 external-drive/A.pdf

% ls --full-time internal-drive/A.pdf
-rwxr-xr-x 1 user user 1773350 2012-05-19 17:14:39.000000000 +0800 internal-drive/A.pdf
The GUI diff program "meld" is able to put a little red do tell the diff.

Is there a way to solve this weird feature ?
 
Old 05-20-2012, 05:19 AM   #2
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,734

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
probably you missed rsync has a feature to copy not only the file but its attributes also (like permissions, ownership and times).
to give more help we need to know how do you invoke rsync
 
Old 05-20-2012, 09:14 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,434

Rep: Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599
Quote:
Originally Posted by centguy View Post
The following shows a typical change:

% ls --full-time external-drive/A.pdf
-rwxr-xr-x 1 user user 1773350 2012-05-19 17:14:38.000000000 +0800 external-drive/A.pdf

% ls --full-time internal-drive/A.pdf
-rwxr-xr-x 1 user user 1773350 2012-05-19 17:14:39.000000000 +0800 internal-drive/A.pdf
FAT-based file systems can only record time to a resolution of 2 seconds, and such a timestamp can never match one with an odd number of seconds. rsync has a "--modify-window=NUM" option to allow small mtime differences to be ignored. You can use "--modify-window=2" to get around the odd/even problem, but you might need to use "--modify-window=3602" to avoid issues with DST time changes.
 
Old 05-21-2012, 01:42 AM   #4
centguy
Member
 
Registered: Feb 2008
Posts: 394
Blog Entries: 1

Original Poster
Rep: Reputation: 35
rknichols:

Bingo. That's exactly what I was looking for.

For now I am using modify-window=1 because rysnc manuals says:

Quote:
--modify-window
When comparing two timestamps, rsync treats the timestamps as being equal if they
differ by no more than the modify-window value. This is normally 0 (for an exact
match), but you may find it useful to set this to a larger value in some situations.
In particular, when transferring to or from an MS Windows FAT filesystem (which rep-
resents times with a 2-second resolution), --modify-window=1 is useful (allowing
times to differ by up to 1 second).
Of course, --modify-window=2 will work too.

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync solaris + ld.so.1: rsync: fatal: libiconv.so.2: open failed: xxx_anuj_xxx Solaris / OpenSolaris 25 02-23-2012 03:23 AM
[SOLVED] rsync execution issue with crontab - Have given full path to rsync too!! Prabagaran Linux - Server 6 04-15-2011 01:39 AM
[SOLVED] rsync fails in cron - ssh key prob for rsync? jonathansfl Linux - Server 6 12-09-2010 09:48 AM
Could I run rsync to download files from a server without rsync daemon? Richard.Yang Linux - Software 1 09-18-2009 04:08 AM
Tomboy+KDE - Minor Glitch t1n0m3n Linux - Software 2 06-13-2007 01:38 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration