Quote:
Originally Posted by Ingla
Thanks for the replies.
Randux: Sounds like a good setup but I'm not sure I'm technically up to speed for that. How did you set up your mirror in the first place - ghost or separate install? I'm not sure a ghost would be bootable.
That's why I'm trying to figure out how to make a cloned disk bootable in its own right.
|
You can boot from anywhere usually. You just have to tell your BIOS the boot search order. I can boot on this box from 4 drives or CD depending on what I set in the BIOS. I use LILO on this multiboot (about 7 OS installed) and I write the same lilo.conf to the MBRs of all drives. That way even if I lose the whole primary drive I can still boot from any living drive. I've tested this and it works a treat.
I set my mirror system up as a mirror- I didn't install anything a second time. The mirroring isn't difficult if you understand how your system is laid out. Let's give an example...
First you must create partitions on the mirror drive to match your main drive. Very important to note that these device names are examples. YOU MUST UNDERSTAND YOUR SYSTEM including what partitions you have available and what you are using them for or YOU MAY LOSE YOUR ARSE
Right, now suppose you have
Code:
Main System
/ /dev/hda1
/home /dev/hda2
/tmp /dev/hda3
swap /dev/hda5
then on your mirror system you must create
Code:
Mirror System
/ /dev/hdd6
/home /dev/hdd7
/tmp /dev/hdd8
# swap does not have to be created, reuse /dev/hda5
# but if you lose your entire main drive you'll have to create a swap
# partition with mkswap. Not critical, you can run Linux without swap.
Note you can reuse the swap since you will not be running both Linux at the same time. You can also reuse /tmp if you like. Actually you can reuse / as well although since we're working up a mirror system you should really backup everything you can't afford to lose.
Now fdisk and create your partitions then create filesystems using fdisk and the mke2fs, mkreiserfs etc whatever you prefer.
Then do rsync to set up your mirror system (again using EXAMPLE DEVICES!)
rsync -axv // /dev/hdd6/
rsync -axv /home/ /dev/hdd7/
Note the trailing '/' which must be present.
Now you must edit fstab (usually in /etc) in your mirror system and change the mountpoints for / /home /temp and swap. Then you must change your boot loader to add an entry for the new system. You will find several files which should be exluded. /dev and /proc come to mind immediately, browser caches and other temp file rubbish are also not worth copying. Figure what you don't need and trim down your backup to be a real backup and not a rubbish heap of unnecessary files. Over time you'll tune this to your preference. Read the man page for rsync to understand how to make an exclusion file.
First try booting your mirror system and debug anything you got wrong such as missing partitions, missing files, etc. Once that's going properly, then it's time to write a script to rsync everything and see if you can boot the system again. Usually you'll find you've broken something either by overwriting something you didn't want overwritten (/etc/fstab for example) or forgot to copy something you needed copied. In a few rounds you'll have everything sorted and working properly.
The last step is to execute your rsync script as an hourly or daily or weekly cronjob whichever you prefer. Rsync is smart enough to copy only files which have been changed so after the first time the backups don't take very long unless you've done quite a bit of work or deleted something accidentally. Take care with that...if you make a mistake and delete your root partition you must quickly disable the cron job or rsync will copy your mistakes to your mirror system! Actually there are several modes rsync will work in. You can tell rsync to copy everything from the main system to the mirror system this is the simplest and safest way to start. You can also tell rsync to copy everything from the main system to the mirror and delete everything that's not on the main system. Eventually you will want to do this else everything you ever delete on your main system will live forever on your mirror and eventually you'll run out of space. BE EXTREMELY CAREFUL and TEST TEST TEST with the rsync --delete option or you MAY LOSE YOUR ARSE! It's a great option but you must understand it thoroughly before putting it into effect.