These are my rsync notes. I also used to use rsnapshot, however I was unhappy with the performance of this application and moved to restic. The original rsnapshot notes have been rolled up and moved to the bottom of this page.

A trailing slash (/) at the end of the first argument in the rsync command: rsync -a dir1/ dir2, mean “the contents of dir1”. The alternative, without the trailing slash, would place dir1, including the directory, within dir2. This would create a hierarchy that looks like: ~/dir2/dir1/[files] So;

  • rsync -a dir1/ dir2 copies the contents only of dir1 into dir2
  • rsync -a dir1 dir2 copies dir1 and its contents into dir2


  • -a is the flag for archive. Keeps original dates and permissions on copy and also recurses, copied sub-directories and content.
  • -u only copies source files where they are newer than destination files (based upon file modification dates)
  • –delete deletes files on the destination where they are not on the source. Use with care!
  • -n is for dry run, no changes are made, but proposed output is seen
  • -P keeps partially copies files and reports progress
  • -h' human readable file sizes
  • -v increase output verbosity
  • -z compress files on transfer, note does not necessarily increase transfer speeds, dependent on file types transferred and CPU speeds

Always double-check your arguments before executing an rsync command. Rsync provides a method for doing this by passing the -n or -–dry-run options. The -v flag (for verbose) is also necessary to get the appropriate output:


Compression option -z can slow down file transfer notes as well as some examples I used


sudo vim Myscripts/rsync_shared.sh or to run sudo bash Myscripts/rsync_shared.sh

#Note this is a local only script and takes no additional batch inputs when run!


Simply type rsync at terminal to see a complete list

Flag Short Flag Long Description
-z --compress compress file data during the transfer
-v --verbose increase verbosity
-a --archive archive mode; equals -rlptgoD (no -H,-A,-X)
-r --recursive recurse into directories
-l --links copy symlinks as symlinks
-p --perms preserve permissions
-t --times preserve modification times
-o --owner preserve owner (super-user only)
-g --group preserve group
-D same as –devices –specials
--devices preserve device files (super-user only)
--specials preserve special files
-H --hard-links preserve hard links *
-A --acls preserve ACLs (implies -p)
-X --xattrs preserve extended attributes
-n --dry-run perform a trial run with no changes made
--delete delete extraneous files from destination
-P same as --partial --progress
--partial keep partially transferred files
--progress show progress during transfer
-h --human-readable output numbers in a human-readable format
-u --update skip files that are newer on the receiver
--exclude=PATTERN exclude files matching PATTERN
--numeric-ids don't map uid/gid values by user/group name
-R --relative Use relative paths. This means that the full path names specified on the command line are sent to the server rather than just the last parts of the filenames.
--delete-excluded also delete excluded files from dest dirs


  • * preservation of hard links is important when moving across rsnapshots backups between disks.

These are some rsnapshot and related rsync notes. They are really long! Sadly the original source was only onlie for a few years.

Rsnapshot and Old Rsync notes, really tl;dr;

  • /app/www/public/data/pages/home_server/home_server_setup/other_services/rsync.txt
  • Last modified: 2023-12-26 Tue wk52 11:38
  • by baumkp