rsync 选项禁用验证?

rud*_*ier 10 rsync

默认情况下rsync验证写入的文件以确保它与原始文件匹配。我可以通过从 /sys 复制一个易失性文件来重现这一点

$ rsync -v /sys/power/state /tmp/
state
rsync: read errors mapping "/sys/power/state": No data available (61)
WARNING: state failed verification -- update discarded (will try again).
state
rsync: read errors mapping "/sys/power/state": No data available (61)
ERROR: state failed verification -- update discarded.

sent 8,328 bytes  received 133 bytes  16,922.00 bytes/sec
total size is 4,096  speedup is 0.48
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1165) [sender=3.1.0]
Run Code Online (Sandbox Code Playgroud)

是否有选项可以将此错误转换为警告并且不会再次丢弃该文件?

上下文:我想使用 rsync 而不是cp解决 coreutils 中的常见错误(自 12 年以来已损坏),请参阅为什么 cp --no-preserve=mode 保留模式?可用的替代工具?

roa*_*ima 7

rsync执行读+写+验证,而不仅仅是读+写。您不能禁用此读后验证选项。

这个文件的复杂性/sys是因为rsync读取时间很短(它需要 4096 个字节,但只有 12 个左右),因此将其视为读取失败。

写完这个答案后不久,我在为什么 rsync 无法从 Linux 中的 /sys 复制文件?.