#! /bin/ksh # Solaris Drive cloneing # Define source and destination device names source="c0t0d0" target="c0t2d0" # Uncomment this if disks are of identical size, # otherwise manually create the disklabels. ##prtvtoc /dev/rdsk/${source}s2 | fmthard -s - /dev/rdsk/${target}s2 partlist=$(prtvtoc /dev/rdsk/${source}s2 | awk '!/\*/{print $1}') for p in $partlist do # don't copy slices 1 and 2 if [ "$p" != "1" -a "$p" != "2" ] then newfs /dev/rdsk/${target}$p < /dev/null mount /dev/dsk/${target}$p /mnt cd /mnt echo "mounted $p ${target}" sleep 1 # use dump and restore via stdout/stdin, cpio -pvdum could also do this ufsdump 0uf - /dev/dsk/${source}$p | ufsrestore rf - cd / umount /mnt fi done # Install a bootloader mount /dev/dsk/${target}s0 /mnt installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${target}s0 umount /mnt exit 0