
私は rsync を使用して同期を行っています:
rsync --rLvv --times --size-only
最初の同期では、次のものを使用することをお勧めします。
rsync --rLvv --times
新しい変更時刻を持つファイルを同期します。問題は、最初の rsync の後、同期されたファイルの変更時刻が次のようになることです。
リモート$ 統計 6080_04_big.mp4 ファイル: `6080_04_big.mp4' サイズ: 258788267 ブロック: 505448 IO ブロック: 4096 通常ファイル デバイス: 903h/2307d Inode: 862897 リンク: 1 アクセス: (0644/-rw-r--r--) Uid: ( 2000/ht) Gid: ( 2000/ cust) アクセス: 2010-08-13 10:46:20.0000000000 -0700 変更: 2010-08-12 17:55:08.0000000000 -0700 変更: 2010-08-13 10:46:20.205721673 -0700
ローカル$統計6080_04_big.mp4 ファイル: `6080_04_big.mp4' サイズ: 258788267 ブロック: 505448 IO ブロック: 4096 通常ファイル デバイス: 902h/2306d Inode: 136015 リンク: 1 アクセス: (0664/-rw-rw-r--) Uid: ( 506/ admin) Gid: ( 506/ admin) アクセス: 2010-08-12 20:55:01.482104000 -0400 変更: 2010-08-12 20:55:08.468122000 -0400 変更: 2010-08-12 21:15:06.952810711 -0400
変更時間は「実質的に」同じですが、秒単位までです。ここでの比較の解像度は何ですか? 秒単位まで同じものはすべて同じと見なされるようです。ただし、これを指定するドキュメントは見つかりません。誰かすぐにわかる人はいませんか?
答え1
私自身の質問に答えると次のようになります。
rsync は、ファイルの変更時間を 1 秒単位の精度に設定する utime() 呼び出しを使用します。したがって、事実上、秒単位まで同じファイルは、rsync のチェックの時間比較部分では同じであるとみなされます。
答え2
rsync ドキュメント (rsync.1.md) より:
0. `--modify-window=NUM`, `-@`
When comparing two timestamps, rsync treats the timestamps as being equal
if they differ by no more than the modify-window value. The default is 0,
which matches just integer seconds. If you specify a negative value (and
the receiver is at least version 3.1.3) then nanoseconds will also be taken
into account. Specifying 1 is useful for copies to/from MS Windows FAT
filesystems, because FAT represents times with a 2-second resolution
(allowing times to differ from the original by up to 1 second).
If you want all your transfers to default to comparing nanoseconds, you can
create a `~/.popt` file and put these lines in it:
> rsync alias -a -a@-1
> rsync alias -t -t@-1
With that as the default, you'd need to specify `--modify-window=0` (aka
`-@0`) to override it and ignore nanoseconds, e.g. if you're copying
between ext3 and ext4, or if the receiving rsync is older than 3.1.3.