rsync 的文件哈希检查可以禁用吗?

rsync 的文件哈希检查可以禁用吗?

我正在从 Ubunutu 更新 OS X 系统,我更希望仅通过时间和文件大小检查文件差异,因为 OS X 的磁盘速度非常慢,我相信这可以加快这个过程。

我相信它还用于验证转账是否成功。我可以放弃这项检查。

答案1

默认情况下,rsync仅比较元数据(大小、权限、修改时间等)来检查已更改的文件。

要在检查文件更改时启用数据校验和,您必须明确传递该--checksum选项。

答案2

来自 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  read-
          ing  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.

          The sending side generates its checksums while it  is  doing  the  file-system  scan  that
          builds  the  list of the available files.  The receiver generates its checksums when it is
          scanning for changed files, and will checksum any file that has the same size as the  cor-
          responding  sender’s  file:   files  with  either a changed size or a changed checksum are
          selected for transfer.

          Note that rsync always verifies that each transferred file was correctly reconstructed  on
          the  receiving  side  by  checking  a whole-file checksum that is generated as the file is
          transferred, but that automatic after-the-transfer verification has  nothing  to  do  with
          this option’s before-the-transfer “Does this file need to be updated?” check.

          For  protocol  30  and  beyond  (first supported in 3.0.0), the checksum used is MD5.  For
          older protocols, the checksum used is MD4.

因此,看起来只要您不指定 -c,它就不会在传输前进行文件校验。但它在传输后仍会进行校验。我在手册页中没有看到任何内容表明可以禁用检查后的校验。

答案3

尝试rsync选项--no-checksum

相关内容