Skip to content

Instantly share code, notes, and snippets.

@gwu1
Last active April 10, 2020 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gwu1/509a57afc9897b7c42ac180802c7ed0a to your computer and use it in GitHub Desktop.
Save gwu1/509a57afc9897b7c42ac180802c7ed0a to your computer and use it in GitHub Desktop.
Useful rsync reference

Local:

rsync -avh --no-compress --progress <source_dir> <dest_dir> --exclude <dir after source_dir> --append-verify

  • a: archive
  • v: increase verbosity
  • h: human readable
  • --no-compress: don't compress to transfer as it's local
  • --progress: show progress
  • --append-verify: can resume if interrupted / failure
  • --exclude: don't copy the specified dir

Remote (SSH):

rsync -aHAXxv --numeric-ids --delete --progress -e "ssh -T -c arcfour -o Compression=no -x" user@<source>:<source_dir> <dest_dir>

  • H: preserves hard-links
  • A: preserves ACLs
  • X: preserves extended attributes
  • x: don't cross file-system boundaries
  • --numeric-ds: don't map uid/gid values by user/group name
  • --delete: delete extraneous files from dest dirs (differential clean-up during sync)

SSH:

  • T: turn off pseudo-tty to decrease cpu load on destination.
  • c arcfour: use the weakest but fastest SSH encryption. Must specify "Ciphers arcfour" in sshd_config on destination.
  • o Compression=no: Turn off SSH compression.
  • x: turn off X forwarding if it is on by default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment