ATTENTION! Your default kernel always uses the root device per default from which he origins. This is hardcoded. You can change this at boot time using the boot -a (man boot) command at the boot prompt. It is NOT possible to script this (even using the /etc/boot.conf). This is not really a problem, cs if your master disk fails, the kernel switches to the next available root device. But if you switch the master/clone disks after cloning in their machine slots, it will boot from the cloned (the 'new' master), but will use the still existing old master disk (the 'new' clone) as root device. That's a little bit confusing. Hint: If your master disk crashes, reclone it from the slave and put it into the first slot and let them run as the master.
if [ $# -lt 2 ]; then
echo "usage: do_clone.sh FROM TO"
echo "example: do_clone.sh wd0 wd1"
$DISKLABEL $SRC > /dev/null || exit
$DISKLABEL $TAR > /dev/null || exit
$DISKLABEL $SRC > $LABEL
$FDISK -yi $TAR
$DISKLABEL -R $TAR $LABEL
cat $LABEL | grep ' # /' | (
while read LINE; do
echo "$SLICE is $PATH"
$NEWFS -q $SLICE
$MOUNT /dev/$SLICE $MNT
($DUMP -0f - $PATH )|(cd $MNT; $RESTORE -rf -)
cp /usr/mdec/boot $MNT/boot
/usr/mdec/installboot -v $MNT/boot /usr/mdec/biosboot $TAR