在 rsync 之后 diff return 应该什么都没有吗?
Should diff return nothing after rsync?
我刚刚使用
创建了一个备份
rsync -av --delete projects/ /Volumes/daten/projects/
后来我运行
diff -r projects/ /Volumes/daten/projects/
只是为了检查是否一切正常,期待 diff 没有输出。但是,diff 发现了很多不同之处。这是否意味着 rsync 没有正确同步我的数据?
更新: 重新运行rsync时似乎没问题,rsync无事可做:
$ rsync -av --delete projects/ /Volumes/daten/projects/
building file list ... done
sent 470414 bytes received 20 bytes 188173.60 bytes/sec
total size is 295619054 speedup is 628.40
但是,diff 并没有停止生成输出,就好像有很多不同的文件一样。这是一小段摘录:
$ diff -r projects/ /Volumes/daten/projects/
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_dep/debug/package_dependencies/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_dep/debug/package_dependencies/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:41 CST 2018
---
> #Sun Nov 04 19:34:13 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_1/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_1/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:41 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_2/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_2/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:41 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_3/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_3/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_4/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_4/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:52:00 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_5/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_5/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_6/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_6/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_7/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_7/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_8/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_8/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_9/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_9/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/packageInstantRunResourcesDebug/tmp/debug/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/packageInstantRunResourcesDebug/tmp/debug/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:34 CST 2018
---
> #Sun Nov 04 19:33:52 CET 2018
Binary files projects/CatClicker/app/build/intermediates/incremental-classes/debug/instant-run-bootstrap.jar and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-classes/debug/instant-run-bootstrap.jar differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/compat/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/compat/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreui/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreui/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreutils/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreutils/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/fragment/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/fragment/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/animated/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/animated/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/mediacompat/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/mediacompat/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v4/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v4/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$anim.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$anim.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$attr.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$attr.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$bool.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$bool.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$dimen.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$dimen.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$drawable.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$drawable.class differ
好像很多文件都没有被rsync看成"different"。默认情况下,rsync 仅检查文件大小和文件的最后修改时间戳。请尝试使用带有 -c/--checksum
选项的 rsync 来打开校验和并再次 运行 "diff"。
摘自 rsync 手册页:
-c, --checksum
This changes the way rsync checks if the files have been changed and are in need of a transfer. Without this option,
rsync uses a "quick check" that (by default) checks if each file's size and time of last modification match between the
sender and receiver. This option changes this to compare a 128-bit checksum for each file that has a matching size.
Generating the checksums means that both sides will expend a lot of disk I/O reading all the data in the files in the
transfer (and this is prior to any reading that will be done to transfer changed files), so this can slow things down
significantly.
我刚刚使用
创建了一个备份rsync -av --delete projects/ /Volumes/daten/projects/
后来我运行
diff -r projects/ /Volumes/daten/projects/
只是为了检查是否一切正常,期待 diff 没有输出。但是,diff 发现了很多不同之处。这是否意味着 rsync 没有正确同步我的数据?
更新: 重新运行rsync时似乎没问题,rsync无事可做:
$ rsync -av --delete projects/ /Volumes/daten/projects/
building file list ... done
sent 470414 bytes received 20 bytes 188173.60 bytes/sec
total size is 295619054 speedup is 628.40
但是,diff 并没有停止生成输出,就好像有很多不同的文件一样。这是一小段摘录:
$ diff -r projects/ /Volumes/daten/projects/
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_dep/debug/package_dependencies/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_dep/debug/package_dependencies/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:41 CST 2018
---
> #Sun Nov 04 19:34:13 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_1/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_1/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:41 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_2/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_2/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:41 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_3/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_3/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_4/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_4/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:52:00 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_5/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_5/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_6/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_6/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_7/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_7/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_8/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_8/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_9/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/ir_slices/debug/package_slice_9/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:42 CST 2018
---
> #Sun Nov 04 19:34:14 CET 2018
diff -r projects/CatClicker/app/build/intermediates/incremental/packageInstantRunResourcesDebug/tmp/debug/dex-renamer-state.txt /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental/packageInstantRunResourcesDebug/tmp/debug/dex-renamer-state.txt
1c1
< #Sat Dec 08 16:17:34 CST 2018
---
> #Sun Nov 04 19:33:52 CET 2018
Binary files projects/CatClicker/app/build/intermediates/incremental-classes/debug/instant-run-bootstrap.jar and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-classes/debug/instant-run-bootstrap.jar differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/compat/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/compat/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreui/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreui/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreutils/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/coreutils/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/fragment/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/fragment/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/animated/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/graphics/drawable/animated/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/mediacompat/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/mediacompat/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v4/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v4/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$anim.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$anim.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$color.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/android/support/v7/appcompat/R$color.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$attr.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$attr.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$bool.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$bool.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$dimen.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$dimen.class differ
Binary files projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$drawable.class and /Volumes/daten/projects/CatClicker/app/build/intermediates/incremental-verifier/debug/cyberdynesoftware/catclicker/R$drawable.class differ
好像很多文件都没有被rsync看成"different"。默认情况下,rsync 仅检查文件大小和文件的最后修改时间戳。请尝试使用带有 -c/--checksum
选项的 rsync 来打开校验和并再次 运行 "diff"。
摘自 rsync 手册页:
-c, --checksum
This changes the way rsync checks if the files have been changed and are in need of a transfer. Without this option, rsync uses a "quick check" that (by default) checks if each file's size and time of last modification match between the sender and receiver. This option changes this to compare a 128-bit checksum for each file that has a matching size. Generating the checksums means that both sides will expend a lot of disk I/O reading all the data in the files in the transfer (and this is prior to any reading that will be done to transfer changed files), so this can slow things down significantly.