diff应该在rsync之后不返回任何内容吗?

时间:2019-02-09 22:08:36

标签: backup diff 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

1 个答案:

答案 0 :(得分:1)

rsync似乎没有将许多文件视为“不同”的文件。默认情况下,rsync仅检查文件大小和文件的最后修改时间戳。请尝试将rsync与-c/--checksum选项一起使用以打开校验和并再次运行“ diff”。

rsync手册页摘录:

  

-c,--checksum

     

这将更改rsync检查文件是否已更改以及是否需要传输的方式。没有这个选项                 rsync使用“快速检查”功能(默认情况下)检查每个文件的大小和上次修改时间是否与                 发送者和接收者。此选项将其更改为比较每个具有匹配大小的文件的128位校验和。                 生成校验和意味着双方将花费大量磁盘I / O来读取文件中所有文件中的数据。                 传输(这是在进行任何读取以传输更改的文件之前的操作),因此这可能会减慢速度