Este comando deve ser tudo que você precisa. Por padrão, rsync
usa o que é chamado de algoritmo de verificação rápida:
Rsync finds files that need to be transferred using a "quick check" algorithm (by default) that looks for files that have changed in size or in last-modified time. Any changes in the other preserved attributes (as requested by options) are made on the destination file directly when the quick check indicates that the file’s data does not need to be updated.
Isso geralmente é bom na maioria dos aplicativos. É mais rápido que o método alternativo que calcula uma soma de verificação para cada arquivo. Este segundo método garantirá as diferenças de rastreamento que podem passar pelo primeiro método.
Em qualquer caso, rsync
não mantém várias cópias de arquivos, é uma copiadora / sincronizadora de arquivos que mantém um diretório sincronizado com outro de acordo com as opções que você fornece.
Método Checksum
Se você está curioso, aqui está a mudança que eu uso para rsync
para realizar esse tipo de sincronização:
$ rsync -avvz -O --stats --checksum --human-readable --acls \
--itemize-changes --progress \
--out-format='[%t] [%i] (Last Modified: %M) (bytes: %-10l) %-100n' \
"SRC" "DEST"
Isso gera esse tipo de saída:
2014/02/20 09:51:49 INFO sending incremental file list
2014/02/20 09:51:49 INFO delta-transmission disabled for local transfer or --whole-file
2014/02/20 09:51:49 INFO [2014/02/20 09:51:48] [.d..t......] (Last Modified: 2014/02/19-15:51:34) (bytes: 0 ) ./
2014/02/20 09:51:49 INFO [2014/02/20 09:51:48] [>f+++++++++] (Last Modified: 2014/02/19-15:51:33) (bytes: 27981892 ) somefile.zip
27.98M 100% 82.27MB/s 0:00:00 (xfer#1, to-check=0/2) 0
2014/02/20 09:51:49 INFO total: matches=0 hash_hits=0 false_alarms=0 data=27981892
2014/02/20 09:51:49 INFO
2014/02/20 09:51:49 INFO rsync[25205] (sender) heap statistics:
2014/02/20 09:51:49 INFO arena: 1060864 (bytes from sbrk)
2014/02/20 09:51:49 INFO ordblks: 1 (chunks not in use)
2014/02/20 09:51:49 INFO smblks: 4
2014/02/20 09:51:49 INFO hblks: 1 (chunks from mmap)
2014/02/20 09:51:49 INFO hblkhd: 135168 (bytes from mmap)
2014/02/20 09:51:49 INFO allmem: 1196032 (bytes from sbrk + mmap)
2014/02/20 09:51:49 INFO usmblks: 0
2014/02/20 09:51:49 INFO fsmblks: 304
2014/02/20 09:51:49 INFO uordblks: 667008 (bytes used)
2014/02/20 09:51:49 INFO fordblks: 393856 (bytes free)
2014/02/20 09:51:49 INFO keepcost: 393552 (bytes in releasable chunk)
2014/02/20 09:51:49 INFO
2014/02/20 09:51:49 INFO rsync[25207] (server receiver) heap statistics:
2014/02/20 09:51:49 INFO arena: 286720 (bytes from sbrk)
2014/02/20 09:51:49 INFO ordblks: 2 (chunks not in use)
2014/02/20 09:51:49 INFO smblks: 3
2014/02/20 09:51:49 INFO hblks: 3 (chunks from mmap)
2014/02/20 09:51:49 INFO hblkhd: 667648 (bytes from mmap)
2014/02/20 09:51:49 INFO allmem: 954368 (bytes from sbrk + mmap)
2014/02/20 09:51:49 INFO usmblks: 0
2014/02/20 09:51:49 INFO fsmblks: 224
2014/02/20 09:51:49 INFO uordblks: 174480 (bytes used)
2014/02/20 09:51:49 INFO fordblks: 112240 (bytes free)
2014/02/20 09:51:49 INFO keepcost: 102352 (bytes in releasable chunk)
2014/02/20 09:51:49 INFO
2014/02/20 09:51:49 INFO rsync[25206] (server generator) heap statistics:
2014/02/20 09:51:49 INFO arena: 135168 (bytes from sbrk)
2014/02/20 09:51:49 INFO ordblks: 2 (chunks not in use)
2014/02/20 09:51:49 INFO smblks: 6
2014/02/20 09:51:49 INFO hblks: 2 (chunks from mmap)
2014/02/20 09:51:49 INFO hblkhd: 401408 (bytes from mmap)
2014/02/20 09:51:49 INFO allmem: 536576 (bytes from sbrk + mmap)
2014/02/20 09:51:49 INFO usmblks: 0
2014/02/20 09:51:49 INFO fsmblks: 400
2014/02/20 09:51:49 INFO uordblks: 82960 (bytes used)
2014/02/20 09:51:49 INFO fordblks: 52208 (bytes free)
2014/02/20 09:51:49 INFO keepcost: 32816 (bytes in releasable chunk)
2014/02/20 09:51:49 INFO
2014/02/20 09:51:49 INFO Number of files: 2
2014/02/20 09:51:49 INFO Number of files transferred: 1
2014/02/20 09:51:49 INFO Total file size: 27.98M bytes
2014/02/20 09:51:49 INFO Total transferred file size: 27.98M bytes
2014/02/20 09:51:49 INFO Literal data: 27.98M bytes
2014/02/20 09:51:49 INFO Matched data: 0 bytes
2014/02/20 09:51:49 INFO File list size: 93
2014/02/20 09:51:49 INFO File list generation time: 1.277 seconds
2014/02/20 09:51:49 INFO File list transfer time: 0.000 seconds
2014/02/20 09:51:49 INFO Total bytes sent: 27.99M
2014/02/20 09:51:49 INFO Total bytes received: 34
2014/02/20 09:51:49 INFO
2014/02/20 09:51:49 INFO sent 27.99M bytes received 34 bytes 11.20M bytes/sec
2014/02/20 09:51:49 INFO total size is 27.98M speedup is 1.00