rsync and backup

rsync

Headache-free, general-purpose backup command.

It probably helps to alias or script this one.

If working with very low-entropy files, perhaps better to remove the --size-only comparison and appeal to timestamps for file differentiation. Otherwise, over the years I found too much superfluous copying/updating merely due to timestamps discrepancy, annoying especially for large-scale backups across drives.

The following invocation also excludes files newer on the receiver.

rsync --archive --update --cvs-exclude --prune-empty-dirs --verbose \
      --human-readable --size-only --delete --stats <source> <dest>
# Alternatively:
rsync -auCmvh --size-only --delete --stats <source> <dest>

Sync from a plain file list (relative to the source directory).

rsync ... --ignore-missing-args --files-from=source.list \
      --recursive <source> <dest>

Tar, gzip, encrypt and timestamp from a file list

tar -zcvf - --files-from source.list |\
    gpg -r <gpg-id> -e > "$dest_prefix""_`date +\%Y\%m\%d`.tar.gz.gpg"

Questions, comments? Connect.