Listing 3: Dual system
#!/bin/sh
# This script is designed to make the debug Sun (Kmita) into the
# production Sun (Babinitch). This script is run on Kmita.
# 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
# Now copy the UNIX configuration files so that if this drive is
# mounted, it will assume the identity of babinitch.
rcp -r babinitch:/usr/local/named /mnt/usr/local/named
rcp -r babinitch:/usr/local/bin /mnt/usr/local/bin
rcp -r babinitch:/var/adm /mnt/var/adm
rcp -r babinitch:/var/audit /mnt/var/audit
rcp -r babinitch:/var/cron /mnt/var/cron
rcp -r babinitch:/var/dt /mnt/var/dt
rcp -r babinitch:/var/log /mnt/var/log
rcp -r babinitch:/var/lp /mnt/var/lp
rcp -r babinitch:/var/nis /mnt/var/nis
rcp -r babinitch:/var/yp /mnt/var/yp
rcp -r babinitch:/etc/inet /mnt/etc/inet
rcp -r babinitch:/etc/net /mnt/etc/net
rcp babinitch:/etc/passwd /mnt/etc/passwd
rcp babinitch:/etc/named.boot /mnt/etc/named.boot
rcp babinitch:/etc/bootptab /mnt/etc/bootptab
rcp babinitch:/etc/ethers /mnt/etc/ethers
rcp babinitch:/etc/group /mnt/etc/group
rcp babinitch:/etc/aliases /mnt/etc/aliases
rcp babinitch:/etc/netgroup /mnt/etc/netgroup
rcp babinitch:/etc/rpc /mnt/etc/rpc
rcp babinitch:/etc/mail/sendmail.cf /mnt/etc/mail/sendmail.cf
rcp babinitch:/etc/defaultrouter /mnt/etc/defaultrouter
rcp babinitch:/etc/defaultdomain /mnt/etc/defaultdomain
rcp babinitch:/etc/hostname.hme0 /mnt/etc/hostname.hme0
rcp babinitch:/etc/hosts.equiv /mnt/etc/hosts.equiv
rcp babinitch:/etc/hosts.lpd /mnt/etc/hosts.lpd
rcp babinitch:/etc/resolv.conf /mnt/etc/resolv.conf
rcp babinitch:/etc/termcap /mnt/etc/termcap
rcp babinitch:/etc/nodename /mnt/etc/nodename
rcp babinitch:/etc/lpd.perms /mnt/etc/lpd.perms
rcp babinitch:/etc/printcap /mnt/etc/printcap
rcp babinitch:/etc/nsswitch.conf /mnt/etc/nsswitch.conf
rcp babinitch:/etc/auto_home /mnt/etc/auto_home
rcp babinitch:/etc/auto_master /mnt/etc/auto_master
# Alternate boot device is now set up. Unmount and exit.
umount /mnt
exit
|