Date: Fri, 18 Aug 2017 16:20:07 -0400 From: "Karl Vogel" <vogelke@pobox.com> To: freebsd-questions@freebsd.org Subject: Re: Anything specific to keep in mind restoring from rsync? Message-ID: <20170818202007.GA23449@bsd118.wpafb.af.mil> In-Reply-To: <20170818221842.I98697@sola.nimnet.asn.au> References: <mailman.87.1503057602.63147.freebsd-questions@freebsd.org> <20170818221842.I98697@sola.nimnet.asn.au>
next in thread | previous in thread | raw e-mail | index | archive | help
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@openssh.com -i $HOME/.ssh/bkup_ed25519" \
$HOME/notebook/$ymd/Maildir/ \
backup.example.com:$HOME/notebook/$ymd/Maildir
exit 0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170818202007.GA23449>
