Home Explore Blog CI



man-pages

65th chunk of `rsync.man`
6812da33a6d17728e4fed25b28f100a530827fdf385969620000000100000fec
 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).

              When  a  modern  rsync resumes the transfer of a file in the par‐
              tial‐dir, that partial file is now updated  in‐place  instead  of
              creating yet another tmp‐file copy (so it maxes out at dest + tmp
              instead of dest + partial + tmp).  This requires both ends of the
              transfer to be at least version 3.2.0.

              For the purposes of the daemon‐config’s "refuse options" setting,
              --partial‐dir  does  not  imply --partial.  This is so that a re‐
              fusal of the --partial option can be used to disallow  the  over‐
              writing of destination files with a partial transfer, while still
              allowing the safer idiom provided by --partial‐dir.

       --delay‐updates
              This option puts the temporary file from each updated file into a
              holding  directory  until  the end of the transfer, at which time
              all the files are renamed into place in rapid  succession.   This
              attempts  to make the updating of the files a little more atomic.
              By default the files are placed into a directory named .~tmp~  in
              each  file’s  destination  directory, but if you’ve specified the
              --partial‐dir option, that directory will be used  instead.   See
              the comments in the --partial‐dir section for a discussion of how
              this  .~tmp~ dir will be excluded from the transfer, and what you
              can do if you want rsync to cleanup old .~tmp~ dirs that might be
              lying around.  Conflicts with --inplace and --append.

              This option implies --no‐inc‐recursive since it  needs  the  full
              file list in memory in order to be able to iterate over it at the
              end.

              This  option  uses more memory on the receiving side (one bit per
              file transferred) and also requires enough free disk space on the
              receiving side to hold an additional  copy  of  all  the  updated
              files.   Note  also  that  you should not use an absolute path to
              --partial‐dir unless:

              1.     there is no chance of any of the  files  in  the  transfer
                     having  the same name (since all the updated files will be
                     put into a single directory if the path is absolute), and

              2.     there are no mount points in the hierarchy (since the  de‐
                     layed  updates  will  fail  if  they can’t be renamed into
                     place).

              See also the "atomic‐rsync" python script in the "support" subdir
              for an update algorithm that is even more atomic (it uses --link‐
              dest and a parallel hierarchy of files).

       --prune‐empty‐dirs, -m
              This option tells the receiving rsync to get rid of empty  direc‐
              tories from the file‐list, including nested

Title: Rsync Options: --partial-dir, RSYNC_PARTIAL_DIR, --delay-updates and --prune-empty-dirs
Summary
This section continues the explanation of `--partial-dir`, covering its security implications and usage with the `RSYNC_PARTIAL_DIR` environment variable. It also delves into the `--delay-updates` option, describing how it uses a temporary holding directory (either `.~tmp~` or the `--partial-dir`) to ensure more atomic file updates, its conflicts with other options like `--inplace`, and its memory and disk space requirements. Finally, it touches on the `--prune-empty-dirs` option, which instructs rsync to remove empty directories from the file list.