Listing 2: Single system, online spare
#!/bin/sh
# This script is designed to make a duplicate boot disk for zagloba .
# and to prepare it so that it can be booted without switching the disk
# ordering.
# In the give credit where credit is due department, it is based on a
# script from Don Geitzen of Sun Microsystems (and tws). Ron Jachim
# modified it for the Karmanos Cancer Institute to replicate their main
# server on demand.
# Define the source (src) and destination (dst) disks
# using standard SVR4 device names in the form cXtXdX.
src=c1t0d0
dst=c1t2d0
# Determine the optimal block size based on the physical parameters
# of the disk drives. You will want to tune this for your disks.
HEADS=16
SPT=135
SECTORSIZE=512
BLOCKSIZE=`expr $HEADS \* $SPT \* $SECTORSIZE`b
# Now copy the entire source drive to the destination drive. Note
# that this assumes that disk partition (slice) 2 is defined as the
# entire disk drive. This is the default for Solaris systems.
dd if=/dev/rdsk/"$src"s2 of=/dev/rdsk/"$dst"s2 bs=$BLOCKSIZE
# Verify that all of the copied partitions are OK
fsck -y /dev/rdsk/"$dst"s0
# Now mount the copied device and modify the /etc/vfstab to reflect
# the destination disk as the boot disk so that all file systems will
# be appropriately mounted during a real boot from the alternate
# device.
mount /mnt
sed < /mnt/etc/vfstab -e s/$src/$dst/g > /tmp/vfstab.new
mv /tmp/vfstab.new /mnt/etc/vfstab
# Alternate boot device is now set up. Unmount and exit.
umount /mnt
exit
|