#! /bin/sh # # clonedisk - A script to simplify cloning SGI system disks # Use at your own risk # Version 1.1 - Last modified June 1, 1994 # # by Steve Kotsopoulos # # note: to use old monitors on an Indy, run 'setenv monitor H' in prom monitor # cat << EOF This script is used to clone a system's boot disk onto another disk. It assumes that both disks use separate root and /usr partitions, that the clone disk is already formatted and partitioned, and that it will use partition 0 for root, and 6 for /usr. If this is not how you do things, you should modify the script to suit your environment before running it (high end systems don't need ide in the volhdr). It first uses dvhtool to setup the volume header. Then, for both / and /usr, it does the following: - uses mkfs to build fresh filesystem - uses dump and restore to copy the filesystem - runs an fsck to make sure everything went OK It also sets up /etc/sys_id on the clone disk. If you need any other files to be different, you'll have to edit them manually. You should run clonedisk in SINGLE USER mode. This keeps the copy clean, as the filesystem isn't changing underneath. EOF if test $# != 2 then echo 'usage: clonedisk sNdN sys_id' echo ' (for example: clonedisk s0d4 indy2.ecf)' exit 1 fi vh=/dev/rdsk/dk$1vh root=/dev/dsk/dk$1s0 rroot=/dev/rdsk/dk$1s0 usr=/dev/dsk/dk$1s6 rusr=/dev/rdsk/dk$1s6 echo this disk will be setup to boot as $2 echo "" echo checking that disk is not in use right now: echo "running df -l | grep $1" df -l | grep $1 echo interrupt if disk is mounted. set -x sleep 10 df -kl mkdir /clone echo adding sash and ide to volume header /etc/dvhtool -v list $vh /etc/dvhtool -v creat /stand/sash sash $vh /etc/dvhtool -v creat /stand/ide ide $vh /etc/dvhtool -v list $vh sync sync sleep 5 echo copying root partition mkfs -i $rroot mount -v $root /clone df -kl cd /clone dump 0f - / | restore xf - rmdir clone echo $2 > etc/sys_id cd / sync sync df -kl umount -v /clone fsck $rroot sleep 5 # un-comment the next 2 lines if you don't use a separate /usr partition # rmdir /clone # exit 0 echo copying /usr partition mkfs -i $rusr mount -v $usr /clone df -kl cd /clone dump 0f - /usr | restore xf - cd / sync sync df -kl umount -v /clone fsck $rusr rmdir /clone