Home Explore Blog CI



man-pages

64th chunk of `rsync.man`
235c2f3d4f66ad5f4578abf051520f744ab4ead02782cfd50000000100000ffb
 which should
              make a subsequent transfer of the rest of the file much faster.

       --partial‐dir=DIR
              This option modifies the behavior of the --partial  option  while
              also  implying  that  it  be enabled.  This enhanced partial‐file
              method puts any partially transferred files  into  the  specified
              DIR  instead  of  writing the partial file out to the destination
              file.  On the next transfer, rsync will use a file found in  this
              dir  as  data to speed up the resumption of the transfer and then
              delete it after it has served its purpose.

              Note that if --whole‐file is specified (or implied), any partial‐
              dir files that are found for a file that is  being  updated  will
              simply  be  removed  (since  rsync is sending files without using
              rsync’s delta‐transfer algorithm).

              Rsync will create the DIR if it is missing,  but  just  the  last
              dir --  not the whole path.  This makes it easy to use a relative
              path (such as "--partial‐dir=.rsync‐partial") to have rsync  cre‐
              ate  the  partial‐directory  in  the destination file’s directory
              when it is needed, and then remove it again when the partial file
              is deleted.  Note that this directory removal is only done for  a
              relative  pathname, as it is expected that an absolute path is to
              a directory that is reserved for partial‐dir work.

              If the partial‐dir value is not an absolute path, rsync will  add
              an  exclude  rule at the end of all your existing excludes.  This
              will prevent the sending of any partial‐dir files that may  exist
              on  the sending side, and will also prevent the untimely deletion
              of partial‐dir items on the  receiving  side.   An  example:  the
              above --partial‐dir option would add the equivalent of this "per‐
              ishable"   exclude   at  the  end  of  any  other  filter  rules:
              -f ’-p .rsync‐partial/’

              If you are supplying your own exclude rules, you may need to  add
              your own exclude/hide/protect rule for the partial‐dir because:

              1.     the  auto‐added rule may be ineffective at the end of your
                     other rules, or

              2.     you may wish to override rsync’s exclude choice.

              For instance, if you want to make rsync  clean‐up  any  left‐over
              partial‐dirs  that  may  be  lying  around,  you  should  specify
              --delete‐after and add a "risk" filter rule, e.g.   -f ’R .rsync‐
              partial/’.  Avoid using --delete‐before or --delete‐during unless
              you don’t need rsync to use any of the left‐over partial‐dir data
              during the current run.

              IMPORTANT: the --partial‐dir should  not  be  writable  by  other
              users or it is a security risk!  E.g. AVOID "/tmp"!

              You  can also set the partial‐dir value the RSYNC_PARTIAL_DIR en‐
              vironment variable.  Setting this in  the  environment  does  not
              force  --partial  to be enabled, but rather it affects where par‐
              tial files go when --partial is specified.  For instance, instead
              of using  --partial‐dir=.rsync‐tmp  along  with  --progress,  you
              could  set  RSYNC_PARTIAL_DIR=.rsync‐tmp  in your environment and
              then use the -P option to turn on the use of the  .rsync‐tmp  dir
              for  partial transfers.  The only times that the --partial option
              does not look for this environment value are:

              1.     when --inplace was specified  (since  --inplace  conflicts
                     with --partial‐dir), and

              2.     when --delay‐updates was specified (see below).

Title: Rsync Option: --partial-dir Details
Summary
This section provides an in-depth explanation of the `--partial-dir` option in rsync. It elaborates on how it works with the `--partial` option, how rsync handles the creation and removal of the partial directory, the interaction with `--whole-file`, and security considerations regarding directory permissions. It also discusses the use of the `RSYNC_PARTIAL_DIR` environment variable and its limitations.