Forum Moderators: bakedjake

Message Too Old, No Replies

rsync

can it do a complete mirror incl. server config files?

         

jamie

8:42 pm on Jan 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

i've just got my first rsync script running by cron and i can't believe i've never used something like this before - a great utility!

my question, not really understanding that much about the linux OS, is whether i can completely mirror my redhat box to a separate location, and in the event of a complete hard drive failure, simply 'roll back' by copying the entire contents of my backup to a new disk, reboot and carry on as normal?

or would i have to configure apache, php, sendmail, etc... before copying back over?

many thanks :-)

SeanW

9:04 pm on Jan 11, 2004 (gmt 0)

10+ Year Member



Sounds doable, except you'd need to have a boot loader installed on your standby disk because rsync won't copy that. That's a one off task, though.

Sean

jamie

9:39 pm on Jan 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi sean,

i'm not quite sure i understood that. care to elaborate?

i wish to use the 2nd drive in our server and also a spare pc in separate location.

much appreciated

SeanW

10:05 pm on Jan 11, 2004 (gmt 0)

10+ Year Member



Hi,

My understanding is that you've got server1 and backup1. Backup1 has its own system drive (/) and the hot spare for server1 mounted on /hotspare. For the sake of simplicity, everything is on one partition.

You're going to rsync server1:/ to backup1:/hotspare such that if you removed /hotspare it would have identical file contents to server1.

The problem occurs when you fail server1. Shut down both machines. Toss server1's disk, replace with backup1's hot spare or a copy thereof.

When you boot, there is no boot sector on server1 because it's not a file that rsync can see, it is a few bytes outside of the filesystem.

What you have to do is apply the boot sector to the hotspare drive (or copy) while it is in backup1. I would also suggest using grub because with LILO, you'd have to rebuild the boot sector on both drives every time you upgraded your kernel. Grub just reads grub.conf to find out which kernel to boot, so as long as the files are the same, you can find the kernel.

You're also going to run into some fun because the drive numbering changes when it goes from backup1 to server1, and grub might look in the wrong place if you didn't configure it properly. You'll want to practice this a few times before going into production to make sure it works smoothly. Luckily, as long as it can find the boot sector, you should be able to get into a grub shell, which can then be used to boot the new kernel by hand.

A low tech way of getting around this is to boot from a boot floppy ;)

Hope this makes sense.

Sean

jamie

7:13 am on Jan 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> hope this makes sense

yes!

thanks for the detail sean. as you suggest, i'll have a fool around on an old machine before going live.

many thanks