Rsync

From Things and Stuff Wiki
Revision as of 17:29, 26 February 2013 by Milk (talk | contribs)
Jump to navigation Jump to search


See also Backup#Rsync

General

  • rsync is a software application and network protocol for Unix-like systems with ports to Windows that synchronizes files and directories from one location to another while minimizing data transfer by using delta encoding when appropriate. Quoting the official website: "rsync is a file transfer program for Unix systems. rsync uses the 'rsync algorithm' which provides a very fast method for bringing remote files into sync." An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. rsync can copy or display directory contents and copy files, optionally using compression and recursion.
--rsh='ssh -p8023'
  flag for non-standard ssh port

Daemon

Arch

#!/bin/sh

START=$(date +%s)
rsync -avh --inplace --no-whole-file /* $1 --exclude= {/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found,/home/*/.gvfs,/var/lib/pacman/sync/*,/home/*/.thumbnails/*,/home/*/.mozilla/firefox/*.default/Cache/*,/home/*/.cache/chromium/*}
FINISH=$(date +%s)
echo "total time: $(( ($FINISH-$START) / 60 )) minutes, $(( ($FINISH-$START) % 60 )) seconds"

touch $1/"Backup from $(date '+%A, %d %B %Y, %T')"
-avh --inplace --no-whole-file
-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
-g, --group                 preserve group
-o, --owner                 preserve owner (super-user only)
-D  --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, save permissions)
-X, --xattrs                preserve extended attributes
-v, --verbose               increase verbosity
    --stats                 give some file-transfer stats
-h, --human-readable        output numbers in a human-readable format
    --progress              show progress during transfer
    --inplace               update destination files in-place, good for cow, implies partial
    --delete-after          receiver deletes after transfer, not during
-W, --whole-file            copy files whole (w/o delta-xfer algorithm)
-d, --dirs                  transfer directories without recursing
rsync -axv --stats --exclude-from=${EXLUDE_FILE} --delete-after /home/clockfort /mnt/clockfort/storage/backups/jolt-home
rsync -a --acls --xattrs --whole-file --numeric-ids --delete --delete-excluded --human-readable --inplace
rsync -aPv --delete --exclude downloads --exclude music --exclude .cache /home/nomaster/ /mnt/backup/nomaster/
--archive --stats --hard-links --partial  --delete --delete-excluded --numeric-ids --inplace -x --timeout 600"
-acSHXA --numeric-ids --del
--archive --sparse --partial --delete --delete-excluded
-av --numeric-ids --delete --delete-excluded --human-readable --inplace
rsync --delete --delete-before --delete-excluded --inplace \
   --no-whole-file -a $@ "$TMP_MOUNT"/ "$BACKUP_DIR"/cur
rsync --archive --one-file-system --hard-links --inplace --numeric-ids --progress --verbose --delete --delete-excluded --exclude=/self_backups

Debian