Make incremental snapshots with hard links

Time Machine style backups: unchanged files are hard links to prev, only changes take new space

rsync -a --delete --link-dest=../prev /src/ ./$(date +%F)/

tool
rsync7 commands
tags
rsyncdiskperformance

More rsync commands

  • rsync -a --partial --append-verify --info=progress2 big.img user@<host>:/dst/

    Continue an interrupted transfer and verify the appended part with a checksum. Note: safe only if the source has not changed

  • rsync -a -e "ssh -p 2222" --exclude-from=excludes.txt /src/ user@<host>:/dst/

    Connect over a custom SSH port and skip paths from excludes.txt (.git, node_modules, *.tmp)

  • rsync -ac --delete-after /src/ /dst/

    Compare files by checksum, not by mtime and size. --delete-after removes files only after the transfer

  • rsync -aHAXv --numeric-ids /src/ user@<host>:/dst/

    Keeps hard links, ACLs, xattrs and numeric uid/gid when you move to a new host. Note: the trailing slash matters

  • rsync -ai --dry-run --delete /src/ /dst/

    Show every change with itemize codes (>f, cd, *deleting) before any file is touched

all 7 rsync commands