rsync a Quick Introduction
A great tool to mirror directories
JD P
Algoloma Systems
My Knowledge About Rsync
- Mirror directories on the same box
- Mirror directories between different machines
- Pull and Push between servers
- ssh tunnels by default for remote connections
- Issues with larger files, YMMV
Directory Mirrors
- rsync will easily mirror directories
rsync -avz source_directory target_directory
On the same machine, it doesn't do file differencing by default.
This impacts expected performance.
- Use the -c, checksum, option to prevent that
Simple Example
rsync -avz /etc/ /backups/romulus/etc
Trailing Slashes
Trailing Slashes are critical
Use a slash to avoid confusion
Local Mirror Example
#!/bin/sh
EXCLUDES=/var/www/rsync_excludes
OPTS="-v -u -a --delete --links --recursive --stats --progress --exclude-from=$EXCLUDES "
BACKDIR="/var/www"
TARGET="/backups/romulus/"
mkdir -p ${TARGET}
rsync ${OPTS} ${BACKDIR} ${TARGET}
Remote Mirror Example
TARGET="userid@server:/backups"
rsync ${OPTS} ${BACKDIR} ${TARGET}
- Uses ~/.ssh/config so ports, userids, servernames can be managed easier
- userid can be left off if it matches the current machine or
- if settings from ~/.ssh/config are used
Rsync Backup Checklist
- Fast - incremental+? Yes if to different system
- Efficient - compressed? No, just the transfers are efficient
- Secure / encrypted? Yes ssh to cryptfs, truecrypt
- Versioned / not simple mirror? No
- Stored Remotely? Yes excells at this
- Restoration Verified? Yes
Rsync Uses
- Not a suitable general backup tool
- Great to push other backups to remote locations
- Great to backup large files that do not change (videos, music)
- Bad for large files that change (virtual machines)
Learn More
- Central backup server w/ 7 day incrementals
Questions?
Questions?
Please send feedback!
- email: jdp (at) algoloma [dot] com
- Website: http://algoloma.com
- Blog: http://blog.jdpfu.com
Thank you.
[any material that should appear in print but not on the slide]