Rsync to backup

I’ll turn this into a script and update the post, but for now:

rsync -avrxP --delete $FILESYSTEMS backup-server:backups/$HOSTNAME

-a, --archive               archive mode; same as -rlptgoD (no -H, -A)
-v, --verbose               increase verbosity
-r, --recursive             recurse into directories
-x, --one-file-system       don't cross file system boundaries
-P                          same as --partial --progress
--progress              show progress during transfer
--partial                   keep partially transfered file in case of interuption,
                                should make a subsequent transfer of the rest of the file much faster.

Some caveats if you want to fully automate this…
- remove -vP (verbose w/ progress)
- –delete is NECESSARY to make sure deleted files get deleted from the
backup
- FILESYSTEMS should be any local filesystems you want backed up (-x
won’t cross filesystems, makes backing up in NFS environment easier)
- obviously this doesn’t preclude a bad guy checking out
backup-server:backups/otherhostname (use ssh keys, and invoke cmd=”cd
backups/hostname; rsync with whatever daemon options” will limit that)
- on backup-server, rotate the backup every 12 hours or whatever.

        - rsync -ar --delete store/hostname.2 store/hostname.3
        - rsync -ar --delete store/hostname.1 store/hostname.2
        - rsync -ar --delete backups/hostname store/hostname.1

# that could be better optimized, but you get the idea

I’ve used this rsync system to successfully maintain up to date backups w/
great ease, AND restore very quickly… use a LinuxCare Bootable Business
Card to get the target fdisked and ready, then mount the filesystems as
you desire, and rsync -avrP backup-server:backups/hostname /target. I got
a 700mb server back online in under 20 minutes from powerup to server
serving requests (the rsync itself is 3 to 5 minutes). Making sure you
do (cd /target; lilo -r . -C etc/lilo.conf)) is the only tricky part.
care of ted@psy_spam_ber.com

Leave a comment

use html pre or code tags for code