rami.info



Cloning A Drive Under Solaris

Posted in Solaris, Sysadmin by Rami on the May 15th, 2006

1. Find the device names of the source and destination drives:
format < /dev/null

2. run the following sh script:
SRC=c0t0d0
DEST=c0t1d0
MOUNTDIR=/clone
SLICES="s0 s1 s2 s3 s4"
mkdir ${MOUNTDIR}
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}s2
# OR installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s0
for i in $SLICES; do
newfs /dev/dsk/${DEST}${i} < /dev/null
mount /dev/dsk/${DEST}${i} ${MOUNTDIR}
cd ${MOUNTDIR}
ufsdump 0f - /dev/dsk/${SRC}${i}| ufsrestore rf -
cd /
umount ${MOUNTDIR}
done
rmdir ${MOUNTDIR}
rm /tmp/vtoc

Leave a Reply