Search code examples
windowsbackupcwrsync

cwRsync, network drive, file modification time issue


I'm using cwRsync 5.4.1 x86 Free under windows and trying to sync folder to network drive. I execute following command:

rsync.exe -rLtv --delete --ignore-errors "/cygdrive/d/1/" "/cygdrive/z/ZipNB/"

Where D is local drive and Z is network drive (external HDD connected to router, RT-N16) Executing it several times gives same result:

>rsync.exe -rLtv --delete --ignore-errors "/cygdrive/d/1/" "/cygdrive/z/ZipNB/"
sending incremental file list
./
1.pdf

sent 11,893,922 bytes  received 38 bytes  1,829,840.00 bytes/sec
total size is 11,890,918  speedup is 1.00

I have one file in the folder and it sends its content each execution. File is same each time and was not changed in the middle.

If I add additional parameter --size-only it works as expected:

>rsync.exe -rLtv --delete --ignore-errors --size-only "/cygdrive/d/1/" "/cygdrive/z/ZipNB/"
sending incremental file list
./

sent 72 bytes  received 22 bytes  188.00 bytes/sec
total size is 11,890,918  speedup is 126,499.13

DIR for both directories:

D:\1>dir
    Volume in drive D is XXX
    Volume Serial Number is XXXX-XXX

Directory of D:\1

08.12.2016  10:04    <DIR>          .
08.12.2016  10:04    <DIR>          ..
24.11.2016  18:31        11 890 918 1.pdf
           1 File(s)     11 890 918 bytes

Z:\ZipNB>dir
 Volume in drive Z is BackUp (at Portable)
 Volume Serial Number is XXXX-XXX

 Directory of Z:\ZipNB

08.12.2016  10:04    <DIR>          .
08.10.2016  20:40    <DIR>          ..
24.11.2016  18:31        11 890 918 1.pdf
           1 File(s)     11 890 918 bytes

I'm not sure but as I'm aware of rsync by default makes verification of file by modification time and size. Both files seems identical. But it seems like cwRsync for some reason gets/sets wrong modification date on file at Z drive. cwRsync works correctly if both directories are on local drive. It happens only with network drive.

In windows properties there is difference in modification time in 1 second, which can cause the problem. windows properties

I took only 1 file as an example only to simplify output, the situation is same heaving any amount of different files. It always sends full content of each file. What can be wrong here, and how I can fix it?


Solution

  • I'm guessing the HDD on the network share uses FAT, because from File Times:

    For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date.

    That would explain the time difference.

    And for this kind of reason rsync added 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. The default is 0, which matches just integer seconds. If you specify a negative value (and the receiver is at least version 3.1.3) then nanoseconds will also be taken into account. Specifying 1 is useful for copies to/from MS Windows FAT filesystems, because FAT represents times with a 2-second resolution (allowing times to differ from the original by up to 1 second).

    So try to add -@1 to your command.