SUMMARY:- CLONING A BOOT DISK ON E450.

From: prabir sarkar <prabir.kr.sarkar_at_gmail.com>
Date: Thu Mar 02 2006 - 09:36:30 EST
Hi,
   Overwhelmed by all that response. this is one thriving and buzzing
community. Many thanks for all those responses. Special thanks to Richard W.
Rominger for sharing that excellent script to clone boot disk. i am sharing
it with all with his permission.

My Original Q was:-

Hi Gurus,
             i will have to clone my boot (having the /, /var, /usr,
/export/home and /opt filesystems) disk on E450 on Solaris 9. i am wondering
will the following steps work:-

1) prvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
2) use newfs to create the filesystems on the c0t1d0
3) ufsdump 0uf /dev/rdsk/c0t1d0s2 /dev/rdsk/c0t0d0s2
4) use install boot to create the bootblocks.

please help me with this. Thanks in Advance. i will summarize.

thanks
Prabir.


the Solution:-

1) prvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t1d0s2
2) use newfs to create the filesystems on c0t1d0.
3) use installboot to install bootblocks on the new disk (c0t1d0).
3) create a temporary mount point, say, /clone,
4) mount the new slice (say c0t1d0s0) at /clone.
5) use*   * ufsdump 0f - / | (cd /clone; ufsrestore rf -)
6) unmount /clone.
7) repeat  steps  4, 5, 6  for the  rest of the slices of the new disk.
8)  modify the /etc/vfstab  in the new disk to use its slices.


Thanks

Prabir**
#!/bin/sh
# Original Script written by Constantin Ionescu
# Modified by Carlo Cosolo
# Modified by Peter Baer Galvin
# Modified by John West
# Modified by Rick Rominger
# Use and distribute freely

# Define variables for use in the script
# ! Important, these must be set correctly !

# The root disk to duplicate (leave off slice numbers and path)
SRC=c0t0d0

# The empty disk to duplicate it to (leave off slice numbers and path)
DEST=c3t0d0

# The directory to mount destination partitions on while duplicating
MOUNTDIR=/dup_0

# The file name of this script, to rename it on the destination to avoid execution
SCRIPT=/opt/local/etc/rootcopy

# The slices that should be copied
SLICES="s0 s3 s4 s5 s6 s7"

echo ====================================
echo Disk Copy script started `date`
echo

# Make sure the mount point for duplicate partitions exists
if [ ! -d $MOUNTDIR ]; then
  mkdir $MOUNTDIR
  chmod 700 $MOUNTDIR
fi

# Partition the duplicate disk, make filesystems, make it bootable
prtvtoc /dev/rdsk/${SRC}s2 > /tmp/vtoc
fmthard -s /tmp/vtoc /dev/rdsk/${DEST}s2
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s0

# Modify the following loop to handle any special cases
for fs in $SLICES
do
  newfs /dev/dsk/${DEST}${fs} < /dev/null; mount /dev/dsk/${DEST}${fs} ${MOUNTDIR};
  ufsdump 0f - /dev/dsk/${SRC}${fs}|(cd ${MOUNTDIR}; ufsrestore rf -);
  if [ $fs = "s0" ]; then
    sed 's/${SRC}/${DEST}/g' /etc/vfstab > ${MOUNTDIR}/etc/vfstab;
    mv ${MOUNTDIR}/${SCRIPT} ${MOUNTDIR}/${SCRIPT}.DONTRUN;
  fi
  umount ${MOUNTDIR}
done

echo
echo Disk Copy script ended `date`
echo ====================================
echo
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Thu Mar 2 09:36:58 2006

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:56 EST