#!/bin/sh # # /secure/mirroring_init # ## We assume we have two identical dsks, source = c0t0d0*, copy=c0t2d0*, ## slice s0 and s5 are active. src_disk="c0t0d0"; dst_disk="c0t2d0"; echo "This SCRIPT WILL WIPE $dst_disk and set it up for mirroring" #fs=`df -k -F ufs| awk '{print $1}'|egrep -v Filesystem` # 1. Partition echo "\nPartition disks.." /usr/sbin/prtvtoc /dev/rdsk/${src_disk}s2 | /usr/sbin/fmthard -n mirror -s - /dev/rdsk/${dst_disk}s2 # filesystems echo "\nCreate filesystems..." newfs ${dst_disk}s0 newfs ${dst_disk}s5 # or: #dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t2d0s2 bs=32768k #fsck # 2. setup /etc/vfstab echo "\nsetup /etc/vfstab" echo "/dev/dsk/${dst_disk}s0 /dev/rdsk/${dst_disk}s0 /newroot ufs 1 no logging" >> /etc/vfstab echo "/dev/dsk/${dst_disk}s5 /dev/rdsk/${dst_disk}s5 /newroot/var ufs 1 no noatime,nosuid" >> /etc/vfstab touch /BOOT_MASTER # 3. mount points echo "\nmake mount points...." mkdir /newroot 2>/dev/null; chmod 777 /newroot ; mount /newroot; mkdir /newroot/var 2>/dev/null; chmod 777 /newroot/var; touch /newroot/BOOT_MIRROR mount /newroot/var; df -k -F ufs umount /newroot/var; umount /newroot; # 4. setup /etc/vfstab.newroot echo "\/etc/vfstab.newroot...." cat > /etc/vfstab.newroot <