Carregar apenas parte modificada do arquivo usando o rsync

0

Estou estudando o rsync para sincronizar pastas remotas e locais nas janelas (usando o cwrsync). Eu tenho uma dúvida, é possível fazer upload de apenas parte das alterações?

Por exemplo, eu tenho um arquivo de 100 MB inicialmente eu vou enviá-lo usando o comando,

rsync -a /source/path/ /dest/path/

Depois, farei algumas alterações nesse arquivo. Se eu executar o mesmo comando novamente, todo o arquivo de 100 MB será carregado novamente. Em vez disso, como anexar as alterações feitas no arquivo durante o upload?

    
por IT researcher 18.04.2016 / 13:28

2 respostas

2

O que você precisa é da opção --inplace .

Recomendamos que você leia a parte relacionada do manual do rsync e entenda o que esta opção implica:

--inplace This option changes how rsync transfers a file when its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is complete, rsync instead writes the updated data directly to the destination file.

This has several effects:

  • Hard links are not broken. This means the new data will be visible through other hard links to the destination file. Moreover, attempts to copy differing source files onto a multiply-linked destination file will result in a "tug of war" with the destination data changing back and forth.
  • In-use binaries cannot be updated (either the OS will prevent this from happening, or binaries that attempt to swap-in their data will misbehave or crash).
  • The file's data will be in an inconsistent state during the transfer and will be left that way if the transfer is interrupted or if an update fails.
  • A file that rsync cannot write to cannot be updated. While a super user can update any file, a normal user needs to be granted write permission for the open of the file for writing to be successful.
  • The efficiency of rsync's delta-transfer algorithm may be reduced if some data in the destination file is overwritten before it can be copied to a position later in the file. This does not apply if you use --backup, since rsync is smart enough to use the backup file as the basis file for the transfer.

WARNING: you should not use this option to update files that are being accessed by others, so be careful when choosing to use this for a copy.

This option is useful for transferring large files with block-based changes or appended data, and also on systems that are disk bound, not network bound. It can also help keep a copy-on-write filesystem snapshot from diverging the entire contents of a file that only has minor changes.

The option implies --partial (since an interrupted transfer does not delete the file), but conflicts with --partial-dir and --delay-updates. Prior to rsync 2.6.4 --inplace was also incompatible with --compare-dest and --link-dest.

Você também pode estar interessado na opção --append ou --append-verify apenas para arquivos em crescimento.

    
por 14.06.2016 / 01:01
1

Você está usando o rsync para copiar de um diretório para outro diretório - A opção - arquivo inteiro está em vigor, então:

-W, --whole-file With this option rsync's delta-transfer algorithm is not used and the whole file is sent as-is instead. The transfer may be faster if this option is used when the bandwidth between the source and destination machines is higher than the bandwidth to disk (especially when the "disk" is actually a networked filesystem). This is the default when both the source and destination are specified as local paths, but only if no batch-writing option is in effect.

Você precisa iniciar o rsync no modo daemon em um lado para acionar o algoritmo rsync com transferências delta.

    
por 15.06.2016 / 22:11

Tags