cwRsync,网络驱动器,文件修改时间问题
cwRsync, network drive, file modification time issue
我在 windows 下使用 cwRsync 5.4.1 x86 Free 并尝试将文件夹同步到网络驱动器。
我执行以下命令:
rsync.exe -rLtv --delete --ignore-errors "/cygdrive/d/1/" "/cygdrive/z/ZipNB/"
其中D为本地盘,Z为网络盘(外接硬盘连接路由器,RT-N16)
多次执行得到相同的结果:
>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
我的文件夹中有一个文件,它会在每次执行时发送其内容。文件每次都一样,中间没有改。
如果我添加额外的参数 --size-only 它会按预期工作:
>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:
D:>dir
Volume in drive D is XXX
Volume Serial Number is XXXX-XXX
Directory of D:
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
我不确定,但我知道 rsync 默认情况下会通过修改时间和大小来验证文件。这两个文件似乎相同。但由于某些原因,似乎 cwRsync gets/sets Z 驱动器文件的修改日期错误。如果两个目录都在本地驱动器上,则 cwRsync 可以正常工作。它只发生在网络驱动器上。
在 windows 属性中,修改时间有 1 秒的差异,这可能会导致问题。
我只以1个文件为例,只是为了简化输出,不管有多少不同的文件,情况都是一样的。它总是发送每个文件的完整内容。
这里可能有什么问题,我该如何解决?
我猜网络共享上的 HDD 使用 FAT,因为从 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.
这样就可以解释时差了。
并且出于这种原因 rsync 添加了 --modify-window 选项:
-@, --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).
因此请尝试将 -@1 添加到您的命令中。
我在 windows 下使用 cwRsync 5.4.1 x86 Free 并尝试将文件夹同步到网络驱动器。 我执行以下命令:
rsync.exe -rLtv --delete --ignore-errors "/cygdrive/d/1/" "/cygdrive/z/ZipNB/"
其中D为本地盘,Z为网络盘(外接硬盘连接路由器,RT-N16) 多次执行得到相同的结果:
>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
我的文件夹中有一个文件,它会在每次执行时发送其内容。文件每次都一样,中间没有改。
如果我添加额外的参数 --size-only 它会按预期工作:
>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:
D:>dir
Volume in drive D is XXX
Volume Serial Number is XXXX-XXX
Directory of D:
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
我不确定,但我知道 rsync 默认情况下会通过修改时间和大小来验证文件。这两个文件似乎相同。但由于某些原因,似乎 cwRsync gets/sets Z 驱动器文件的修改日期错误。如果两个目录都在本地驱动器上,则 cwRsync 可以正常工作。它只发生在网络驱动器上。
在 windows 属性中,修改时间有 1 秒的差异,这可能会导致问题。
我只以1个文件为例,只是为了简化输出,不管有多少不同的文件,情况都是一样的。它总是发送每个文件的完整内容。 这里可能有什么问题,我该如何解决?
我猜网络共享上的 HDD 使用 FAT,因为从 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.
这样就可以解释时差了。
并且出于这种原因 rsync 添加了 --modify-window 选项:
-@, --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).
因此请尝试将 -@1 添加到您的命令中。