Anything specific to keep in mind restoring from rsync?

Karl Vogel vogelke at pobox.com
Fri Aug 18 20:20:24 UTC 2017


On Fri, Aug 18, 2017 at 10:59:33PM +1000, Ian Smith wrote:
> rsync is great for 'user data', but I'm not sure whether it handles hard 
> links properly, which you'll want for system directories at least.

  Use the "-H" option to handle hard links.  This might burn you if
  you're providing a list of files to rsync instead of letting it roam
  over an entire tree; if all the linked files aren't included in your
  list, rsync has no way of knowing about them.

> Do you have some reason not to use the canonical dump(8) and restore(8)?  

  I avoid those because I copy between different systems (Linux, Solaris,
  BSD) much more often than between identical ones.

> If you're going with rsync, I strongly suggest not using /tmp; all sorts 
> of things may use that for, well, temporary files during the operation.

  Good advice -- you want a real filesystem for your target.  The only
  other thing I can think of is watch the trailing slashes in rsync
  arguments; it makes a big difference in where your files end up.

  I use the script below to sync Maildirs under date-based directories
  between two systems.

-- 
Karl Vogel                      I don't speak for the USAF or my company

Mangled song lyric: Baking carrot biscuits.
Actual lyric: Taking care of business.  ("Takin' Care Of Business")

--------------------------------------------------------------------------
#!/bin/ksh
#<syncmail: sync mail to backup

export PATH=/usr/local/bin:/bin:/sbin:/usr/bin

# Allow a date argument.
case "$#" in
    0) when='today' ;;
    *) when="$@" ;;
esac

ymd=$(date -d "$when" '+%Y/%m%d' 2> /dev/null)
case "$?" in
    0) ;;
    *) echo "$when: bad date" >&2 ; exit 1 ;;
esac

# Do the copy, and delete extraneous destination files.
rsync -raxu --delete -e \
    "ssh -c chacha20-poly1305 at openssh.com -i $HOME/.ssh/bkup_ed25519" \
    $HOME/notebook/$ymd/Maildir/ \
    backup.example.com:$HOME/notebook/$ymd/Maildir

exit 0


More information about the freebsd-questions mailing list