Mirroring 2 IDE Drive Linux
bet at rahul.net
Wed Aug 7 07:53:04 EST 2002
> I am trying to clone to the secondary slave drive and be take the
> primary out and change the slave to primary and boot from it. The
> problem I am having is that it the copied drive will not boot, It
> is not getting the lilo boot and config properly.
I've done this before --- some years back, and on a different
platform, but I'm pretty the same issues apply here.
Rsync is a fine tool for the vast majority of your replication.
Perhaps not the very best, it's optimized for a somewhat different
use pattern, but it works very well indeed. Use rsync to copy all
the files in each of the filesystems.
Your problem is that making a disk bootable, under every Unix-like
OS I've worked with, requires updating some data that lies outside
the visible filesystem, in boot blocks.
You need to make yourself a mirror script. After it runs rsync to
get all the files in the filesystems mirrored properly, you'll need
to re-install the boot sector on the secondary drive. How to do that
depends on details of how your boot loader is set up.
You say you're using LILO. To re-install the boot block on your main
disk, you just invoke "lilo" with no arguments.
But you need to adjust lilo's behavior in two ways. It needs to be
looking for the config files, and boot sector boilerplate, and most
importantly the kernel image whose block numbers it wants to record
in the boot block, on the secondary drive. That part's easy, just
use the cmdline option to chroot lilo into the directory tree where
you've mounted the partition[s] of your secondary drive.
The hard part is then telling lilo to write a boot sector, intended
for booting /dev/hda1 or whatever, onto /dev/hdb. That will take
some experimenting, and if you mess up you could clobber your real
working boot sector, so make sure you have a good boot floppy before
you launch this exercise. It may suffice to just make an alternative
config file, which you can specify with another lilo cmdline arg,
that specifies "boot=/dev/hdb".
This is my favourite boot disk replication strategy. It's easier to
boot off an alternative disk than it is to recover after drive
failure from any drive mirroring setup I've seen; and unlike drive
mirroring, if you run this out of an init script at boot time,
you'll be capturing the last config that was demonstrated to boot
successfully, and thereby helping to protect yourself against
accidental admin errors that make the system unbootable --- far more
common in my experience than drive failures.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/rsync/attachments/20020807/857c79a1/attachment.bin
More information about the rsync