Home Explore Blog CI



man-pages

85th chunk of `rsync.man`
9bf21ff9b85cf3473167fc6d098b8b7dbd239559f5fdfb780000000100000ffe
 merge
       files  on  the  receiving side.  An example of the first is this (assume
       that the remote .rules files exclude themselves):

           rsync ‐av ‐‐filter=’: .rules’ ‐‐filter=’. /my/extra.rules’
              ‐‐delete host:src/dir /dest

       In the above example the extra.rules file can affect both sides  of  the
       transfer,  but  (on  the  sending side) the rules are subservient to the
       rules merged from the .rules files because they were specified after the
       per‐directory merge rule.

       In one final example, the remote side  is  excluding  the  .rsync‐filter
       files  from the transfer, but we want to use our own .rsync‐filter files
       to control what gets deleted on the receiving side.  To do this we  must
       specifically  exclude  the per‐directory merge files (so that they don’t
       get deleted) and then put rules into the local  files  to  control  what
       else should not get deleted.  Like one of these commands:

           rsync ‐av ‐‐filter=’:e /.rsync‐filter’ ‐‐delete \
               host:src/dir /dest
           rsync ‐avFF ‐‐delete host:src/dir /dest

TRANSFER RULES
       In  addition  to  the  FILTER RULES that affect the recursive file scans
       that generate the file list on the sending and (when deleting) receiving
       sides, there are transfer rules. These rules affect which files the gen‐
       erator decides need to be transferred without the side effects of an ex‐
       clude filter rule.  Transfer rules affect only files and never  directo‐
       ries.

       Because a transfer rule does not affect what goes into the sender’s (and
       receiver’s)  file  list,  it  cannot  have any effect on which files get
       deleted on the receiving side.   For  example,  if  the  file  "foo"  is
       present in the sender’s list but its size is such that it is omitted due
       to  a transfer rule, the receiving side does not request the file.  How‐
       ever, its presence in the file list means that a delete  pass  will  not
       remove  a matching file named "foo" on the receiving side.  On the other
       hand, a server‐side exclude (hide) of the file "foo" leaves the file out
       of the server’s file list, and absent a receiver‐side exclude  (protect)
       the  receiver  will  remove a matching file named "foo" if deletions are
       requested.

       Given that the files are still in the sender’s file list,  the  --prune‐
       empty‐dirs  option  will not judge a directory as being empty even if it
       contains only files that the transfer rules omitted.

       Similarly, a transfer rule does not have any extra effect on which files
       are deleted on the receiving side, so setting a maximum  file  size  for
       the transfer does not prevent big files from being deleted.

       Examples  of  transfer rules include the default "quick check" algorithm
       (which compares size & modify time), the --update option, the --max‐size
       option, the --ignore‐non‐existing option, and a few others.

BATCH MODE
       Batch mode can be used to apply the same set of updates to many  identi‐
       cal  systems.  Suppose one has a tree which is replicated on a number of
       hosts.  Now suppose some changes have been made to this source tree  and
       those  changes need to be propagated to the other hosts.  In order to do
       this using batch mode, rsync is run with the write‐batch option to apply
       the changes made to the source tree to one  of  the  destination  trees.
       The  write‐batch  option  causes  the  rsync client to store in a "batch
       file" all the information needed to repeat this operation against other,
       identical destination trees.

       Generating the batch file once saves having to perform the file  status,
       checksum,  and data block generation more than once when updating multi‐
       ple destination trees.  Multicast transport protocols  can  be  used  to
  

Title: Rsync Filter Rules, Transfer Rules and Batch Mode
Summary
This section continues the discussion on rsync filtering, illustrating how to use local .rsync-filter files to control deletions on the receiving side when the remote side excludes these files. It then introduces the concept of "transfer rules," which affect which files are transferred but do not influence the file list used for deletions. Examples of transfer rules include the quick check algorithm, --update, --max-size, and --ignore-non-existing. Finally, it describes the use of batch mode for applying the same updates to multiple identical systems. By using the write-batch option, rsync creates a batch file containing all the necessary information to repeat the operation on other destination trees.