如何强制rsync执行校验和?

我们通过每天晚上在服务器上创build一个增量备份文件(以及周四晚上的完整备份)来执行Windows文件服务器的夜间备份,然后将其复制到运行Linux / Ubuntu的备份服务器。 为了保持场外冗余,我们然后将备份目录rsync同步到每晚运行一次的外部驱动器。

随着时间的推移,增量备份文件的数量稳步增长(尽pipe这些文件的大小有所不同)。

我们也注意到,尽pipersync过程只是将最新的两个文件复制到外部驱动器上,但它仍然需要更长的时间。

这是命令:

rsync -vr --delete-before --log-file=/rsync_log.csv /backup/archive/ /mnt/usbdisk/ 2>&1 

当我们testing命令,并调查了日志文件,我们看到这样的:

 ... 2011/02/14 23:59:35 [14054] >f..T...... IncrementalBackup_2011_02_06_20.bkf 2011/02/15 00:00:45 [14054] >f..T...... IncrementalBackup_2011_02_08_20.bkf 2011/02/15 00:03:22 [14054] >f..T...... IncrementalBackup_2011_02_09_20.bkf 2011/02/15 00:04:36 [14054] >f..T...... IncrementalBackup_2011_02_11_20.bkf 2011/02/15 00:04:51 [14054] >f..T...... IncrementalBackup_2011_02_12_20.bkf 2011/02/15 00:05:06 [14054] >f..T...... IncrementalBackup_2011_02_13_20.bkf 2011/02/15 00:06:13 [14054] >f+++++++++ IncrementalBackup_2011_02_14_20.bkf 2011/02/15 00:54:32 [14054] >f..T...... Thursday_Full_Backup_2011_01_20.bkf 2011/02/15 03:24:41 [14054] >f..T...... Thursday_Full_Backup_2011_01_27.bkf ... 

我们发现每个文件与文件大小有关的时间 – 即使跳过文件(例如 – 完整备份需要大约2.5小时处理,而增量大约2-3分钟或更less)。

实际复制的唯一文件是最新的增量文件。

我们能想到的唯一解释是rysnc正在执行文件的校验和 – 即使文档说默认情况下它不是,而且我们还没有在命令中指定–checksum开关。 当然,它不能花2.5小时来确定时间戳和文件大小?

看完文档之后,除了校验和计算之外,我找不到任何其他解释。 那么,有没有办法确保校验和被禁用?

也许问题出在文件的时间戳上。 如果使用Windows程序创build备份,则可能会混淆时间戳。 如果我复制你的样品一堆照片,我获得这个日志

 2011/02/15 03:46:46 [61820] delta-transmission disabled for local transfer or --whole-file 2011/02/15 03:46:46 [61820] .d..t....... ./ 2011/02/15 03:46:46 [61820] IMG_0055.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0056.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0057.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0058.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0059.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0060.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0061.JPG is uptodate 2011/02/15 03:46:46 [61820] >f..t....... IMG_0062.JPG 2011/02/15 03:46:46 [61820] IMG_0063.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0064.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0065.JPG is uptodate 2011/02/15 03:46:46 [61820] IMG_0066.JPG is uptodate 2011/02/15 03:46:46 [61820] total: matches=0 hash_hits=0 false_alarms=0 data=5911343 2011/02/15 03:46:46 [61820] sent 5912367 bytes received 67 bytes 11824868.00 bytes/sec 2011/02/15 03:46:46 [61820] total size is 75450221 speedup is 12.76 

所以文件每次都被转移,否则你应该有日志消息file xxx is uptodate 。 尝试使用多个v标志来增加rsync的冗长度,以了解发生了什么事情。

什么文件系统是USB驱动器?

有一个FAT和时间戳知道的问题。 请参阅rsync手册页:

  --modify-window When comparing two timestamps, rsync treats the timestamps as being equal if they differ by no more than the modify-window value. This is normally 0 (for an exact match), but you may find it useful to set this to a larger value in some situations. In particular, when transferring to or from an MS Win‐ dows FAT filesystem (which represents times with a 2-second resolution), --modify-window=1 is useful (allowing times to differ by up to 1 second).