Home Explore Blog CI



man-pages

52th chunk of `rsync.man`
e34177d56683a1756d6fdba5841f6402db682a1b16aaf78e0000000100000fe8
 found in DIR that is identical to the
              sender’s file, the file will NOT be transferred to  the  destina‐
              tion  directory.   This is useful for creating a sparse backup of
              just files that have changed from an earlier backup.  This option
              is typically used to copy into an empty (or newly created) direc‐
              tory.

              Beginning in version 2.6.4, multiple  --compare‐dest  directories
              may be provided, which will cause rsync to search the list in the
              order  specified  for  an  exact match.  If a match is found that
              differs only in attributes, a local copy is made and the  attrib‐
              utes  updated.  If a match is not found, a basis file from one of
              the DIRs will be selected to try to speed up the transfer.

              If DIR is a relative path, it is relative to the destination  di‐
              rectory.  See also --copy‐dest and --link‐dest.

              NOTE: beginning with version 3.1.0, rsync will remove a file from
              a  non‐empty  destination hierarchy if an exact match is found in
              one of the compare‐dest hierarchies (making the end  result  more
              closely match a fresh copy).

       --copy‐dest=DIR
              This option behaves like --compare‐dest, but rsync will also copy
              unchanged files found in DIR to the destination directory using a
              local copy.  This is useful for doing transfers to a new destina‐
              tion while leaving existing files intact, and then doing a flash‐
              cutover when all files have been successfully transferred.

              Multiple  --copy‐dest  directories  may  be  provided, which will
              cause rsync to search the list in the order specified for an  un‐
              changed  file.  If a match is not found, a basis file from one of
              the DIRs will be selected to try to speed up the transfer.

              If DIR is a relative path, it is relative to the destination  di‐
              rectory.  See also --compare‐dest and --link‐dest.

       --link‐dest=DIR
              This  option  behaves  like  --copy‐dest, but unchanged files are
              hard linked from DIR to the  destination  directory.   The  files
              must  be identical in all preserved attributes (e.g. permissions,
              possibly ownership) in order for the files to be linked together.
              An example:

                  rsync ‐av ‐‐link‐dest=$PWD/prior_dir host:src_dir/ new_dir/

              If files aren’t linking,  double‐check  their  attributes.   Also
              check  if  some  attributes are getting forced outside of rsync’s
              control, such a mount option that squishes root to a single user,
              or mounts a removable drive with generic ownership  (such  as  OS
              X’s "Ignore ownership on this volume" option).

              Beginning  in version 2.6.4, multiple --link‐dest directories may
              be provided, which will cause rsync to search the list in the or‐
              der specified for an exact match (there is a limit of 20 such di‐
              rectories).  If a match is found that differs only in attributes,
              a local copy is made and the attributes updated.  If a  match  is
              not  found, a basis file from one of the DIRs will be selected to
              try to speed up the transfer.

              This option works best when copying into an empty destination hi‐
              erarchy, as existing files may get their attributes tweaked,  and
              that  can  affect  alternate  destination  files  via hard‐links.
              Also, itemizing of changes can get  a  bit  muddled.   Note  that
              prior  to version 3.1.0, an alternate‐directory exact match would
              never be found (nor linked into the destination) when a  destina‐
      

Title: Rsync Options: --compare-dest (continued), --copy-dest, and --link-dest
Summary
This section of the rsync documentation continues the description of the `--compare-dest` option, noting that from version 3.1.0, rsync can remove files from the destination if an exact match is found in the comparison directory. It then details the `--copy-dest` option, similar to `--compare-dest` but copies unchanged files to the destination. Multiple `--copy-dest` directories can be specified. Finally, it describes the `--link-dest` option, which hard-links unchanged files from the specified directory to the destination. Multiple `--link-dest` directories are supported from version 2.6.4. This option works best when copying into an empty destination.