[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync episode



lina wrote:
> Shaun wrote:
> > lina wrote:
> >> When I tried the rsync -rvz source destination
> >> It re-copied part of already-copied, any idea to prevent it.
> >
> > rsync -avz

Yes.  Rsync needs one of -t or -a to preserve times.  If times are not
preserved then rsync would copy the files again.  Here is the doc:

       -t, --times
              This tells rsync to transfer modification times along
              with the files and update them on the remote system.
              Note that if this option is not used, the optimization
              that excludes files that have not been modified cannot
              be effective; in other words, a missing -t or -a will
              cause the next transfer to behave as if it used -I,
              causing all files to be updated (though rsync’s
              delta-transfer algorithm will make the update fairly
              efficient if the files haven’t actually changed, you’re
              much better off using -t).

Using -a is typical since it turns on -r -t and other useful options
that is almost always what you want.

> Still the same and pretty weird is that it's only partial and every
> time form that points.

Here is a wild guess.  Are you copying files to or from a MS FAT
filesystem?  If so then the issue there is that FAT only stores
timestamps to 2-seconds, not 1-second or more accurate like Unix
filesystems.  In which case if the source file is one of the
unrepresentable seconds timestamps then rsync will try again and again
to set the timestamp.  Here are the docs:

     When transferring to FAT filesystems rsync may re-sync unmodified
     files.  See the comments on the --modify-window option.

     --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 represents times with a 2-second resolution),
            --modify-window=1 is useful (allowing times to differ by
            up to 1 second).

In which case copying to or from FAT may change the timestamp of the
file by one second either way and needs the --modify-window=1 option.

  rsync -rtv --modify=window=1

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: