In a Skolelinux server, it is about duplicating a disk A to a disk B, so if disk A crashes it can be replaced by disk B. It is a kind of software RAID-1 of the poor, I have to admit I fail to get software RAID-1 working as I expected, also I worry that as long as software RAID is not an officialy supported feature in Skolelinux, it may not be reliable to use it, especially when updating the system.
An example of a configuration:
A server with two 80Gb disks mounted in removable racks. Removable rack is an option, but it lets me switch disk easily so I can test the mirroring. RAM is 1 Gb.
I use runlevel 3 (init 3) to effectively start the mirroring. I set this runlevel so that all services are switched off. So basicly doing init 3 in the shell will start the mirroring procedure.
Basicly this runlevel looks like:
hilaire@serveur:~$ ls /etc/rc3.d/ K01kdm K20courier-imap-ssl K20ssh K82quotarpc K11cron K20cupsys K20webmin K85bind K14ppp K20dhcp K20xfs K89atd K19samba K20exim K23ntp-refclock K89klogd K20apache K20inetd K30squid K90sysklogd K20autofs K20ltspnet-nat K80nfs-kernel-server S20copie K20courier-authdaemon K20makedev K80slapd K20courier-imap K20pcmcia K81nfs-common
Only the copie (copy) service is started in this runlevel (S20copie)
This S20copie is quite simple:
#! /bin/sh
#
# single executed by init(8) upon entering runlevel 1 (single).
#
# Version: @(#)single 1.20 26-Geb-2001 miquels@cistron.nl
#
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
# Kill all processes.
echo -n "Sending all processes the TERM signal... "
killall5 -15
echo "done."
sleep 5
echo -n "Sending all processes the KILL signal... "
killall5 -9
echo "done."
# We start update here, since we just killed it.
[ -x /sbin/update ] && update
echo "Demonter les partitions et copier le disque"
umount /var
umount /skoletjener/home0
ash -c 'umount /usr; \
/bin/dd if=/dev/hda of=/dev/hdc bs=800M; \
mount /usr; \
mount /var; \
mount /skoletjener/home0; \
/sbin/init 2'
Partition /usr is unmounted after ash is started, not sure if it can be done directly from bash. The disks are mirrored with the dd command, disk A is /dev/hda and disk B is /dev/hdc, it depends on how are fitted your hard disk, you will have to figure out. The base segment is 800Mb, the server is shipped with 1Gb, with fewer RAM use a smaller bs. After the partition are re-mounted, the system is restarted in the usual runlevel 2, init 2.
An automatic mirroring procedure can be set up with cron, as a root user you can add a daily mirroring procedure with the following command:
echo "15 4 * * * init 3" | crontab -
Each day at local time 04:15 a mirroring procedure will be started.
| Page Execution took 36.246 seconds |