Jennifer Zelazny

Random and Opinionated Thoughts

rsync: synch both boot and data volumes.

HOWTOs UNIX Web Development
Posted by: Jennifer Zelazny | 1 Comment

If you have mission critical servers, you know that a backup is essential. I do not want my mission critical web server to go down. Along comes rsync.

How to set up rsync to synch my boot drive (and make it bootable) as well as synch my data files (html/php files):
First, you will to set up passwordless ssh between your servers. This is a good tutorial, except make sure step #5 is actually: /var/root/.ssh/cat id_rsa.pub >> authorized_keys2 . Now you are ready to send data from your main server to the backup(s).

Data
I have a daily cron job to run my data rsync script.
The script is: time sudo rsync -a -vv -z -e ssh "/Volumes/www" "[email protected]:/Volumes".
(where /Volumes/www is the location of all my data files and 10.0.0.1 is the IP of my backup web server)

Boot drive (that is bootable)
I have a weekly (I chose weekly because if I apply an update to something that proves not to work, I know I have some flexibility) (and yes I always apply updates to a test server first) cron job to run my boot script.
The script is:time sudo rsync -a --exclude /dev/* --exclude /afs/* --exclude /private/tmp/* --exclude /Network/* --exclude /Volumes/* --exclude /automount/* --exclude /private/var/run/* -vv -e ssh "/." [email protected]:/Volumes/BackUp --delete ; sudo rsync -qe ssh 10.0.0.1:'`sudo bless -folder /Volumes/BackUp/System/Library/CoreServices`' .
(where /Volumes/BackUp is the location of all my boot(System) files and 10.0.0.1 is the IP of my backup web server)

Next up: IP Failover! (another day)

Using rsync really cuts down on my worry..well a little, and also helps me keep all my servers synched to the primary server. Enjoy, it is time we started making these servers work for us, not the other way around!

One thought on “rsync: synch both boot and data volumes.”

  1. 202.95.10.156

    Thank you for some other informative web site.
    The place else may just I get that type of info written in such an ideal manner?
    I have a project that I am just now working on, and
    I’ve been on the look out for such info.

Leave a Reply

Your email address will not be published.
*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.