Patch to make rsync preserve access times

Dave Dykstra dwd at bell-labs.com
Wed Sep 5 04:25:41 EST 2001


On Tue, Sep 04, 2001 at 11:53:33AM -0500, Gilbert E. Detillieux wrote:
...
> > The way GNU tar works around this, if I understand correctly, is to
> > remember the original atime, and then go back and reset it after
> > reading.
> 
> Yes, that's my understanding too, but I've never looked at the code.  Note
> also that the cpio command has had a "-a" option to do the same sort of
> thing going back to the early days of UNIX and BSD.

I've been a vocal opponent to adding a preserve access times option to
rsync.  I have been bitten numerous times by a cpio -oa process that system
administrators have set up for making incremental backups, because it
resets the inode change time which I find to be of far greater value.  The
inode change time itself is important for incremental backups, because if
somebody renames a file without accessing it or modifying it, it still
should be backed up under the new name.

I wasn't sure if the -a option worked for cpio -i, to restore an access
time from an archive, so I just tried it.  On Solaris 7, it reset both the
modification and access times to midnight January 1, 1970!  GNU cpio gives
a usage message if you try to use -a with -i; the long name for the -a
option is called --reset-access-time which works with cpio -o, but there is
no -a or --preserve-access-time option for cpio -i.

So cpio can keep access times alone on the input side but will not send
them through to the output side.  I don't think rsync should either.  If
the files have been copied, they've been accessed so I don't think it's
a big deal if the access time has been updated.


...
> Some people may be concerned about the mods to ctime, which can hardly be
> avoided, but I don't see that being a problem in practice.  I'm already used
> to ctime being changed at the drop of a hat, and don't find them reliable
> for much.

I've had the opposite experience.  Ctimes are the only reliable way to find
out when a file has had some change made to them, and atimes aren't useful
for much.


...
> I find the patch (with my corrections) to be important enough that I
> certainly intend to use it on my systems. 

What are you using the access times for?

- Dave Dykstra




More information about the rsync mailing list