rsync feature needed: preserve atime

Matt McCutchen hashproduct+rsync at gmail.com
Wed May 9 22:47:39 GMT 2007


On 5/9/07, Dave Dykstra <dwd at drdykstra.us> wrote:
> What does it really mean to preserve access times?  When rsync reads
> a file to copy it, it will change the access time just because it is
> reading it, so the backup should then have the correct access time,
> the time the backup file was created.

I tested HEAD of rsync + atimes.diff and it indeed behaves this way,
which is silly: rsync destroys the data it is told to preserve!  The
atimes.test doesn't catch this because it uses a zero-length file, so
there is no read to actually hit the atime.

> Some tools have an option to
> reset the access time of the file they copy, but in so doing the tools
> update the inode change time of the input file which is generally more
> important to users than access time.  It is not possible to preserve
> both as a filesystem user like rsync.

It is possible on some filesystems to read a file without hitting its
atime by opening it with O_NOATIME.  The same issues apply to GNU tar,
so there was an extensive discussion on the bug-tar mailing list of
how not to destroy atimes of source files (including use of
O_NOATIME):

http://lists.gnu.org/archive/html/bug-tar/2005-09/msg00035.html

Personally, I don't like access times because they're impure in the
sense that reading shouldn't write and as far as I know they don't
have any important uses.  All of my computer's filesystems are mounted
noatime.

Matt


More information about the rsync mailing list