Hi,
We use the following script for unmirroring the one of the rootvg disks:
===========================
#!/bin/ksh
############################################################
# This script unmirrors the system disk
# The script will be activated by the engineer that configures the system after one of the mirror disks failure
# The scripts displays the disks which are part of the rootvg and lets the user to select one of them as target.
# Usage: unmirrordisk.sh
###########################################################################################
#set -x
DATE1=`date`
DATE2=`date +%m%d%H%M%y`
LOGFILE=”/scitex/version/logs/unmirrordisk.log”
echo “###################################################################“ > $LOGFILE
echo “-------This is a unmirrordisk.sh log file from $DATE1-------------------“ >> $LOGFILE
echo “###################################################################“ >> $LOGFILE
select_destination ()
{
#Display all disks that belong to rootvg
#let the user to choose the one he wants to unmirror
lspv |grep rootvg|awk '{ print $1 }' > /tmp/target_disk
integer A=1
for I in `cat /tmp/target_disk`
do
free_hdisk[A]=$I
A=$A+1
done
A=$A-1
if [[ $A = 1 ]] ;then
echo “\nNo target disks are available in the system !\n” |tee -a $LOGFILE
exit 1
fi
echo "---------------------------------------------------" |tee -a $LOGFILE
echo “The following disks are part of rootvg.”
printf -- "\nSelect the destination disk that you want to unmiror: [] \n\n"
PS3="choose >>"
select DEST_DISK in ${free_hdisk[*]}
do
if [[ -z $DEST_DISK ]] ;then
printf -- "\n\tChoose the right number !\n\n"
else
break
fi
done
echo “\nThe disk that will be unmirrored is $DEST_DISK” |tee –a $LOGFILE
#check which disk is the good rootvg disk
SOURCE_DISK=`lspv|grep rootvg|awk '{ print $1 }’ |grep –v $DEST_DISK`
echo “The good disk is $SOURCE_DISK” |tee –a $LOGFILE
}
while true
select_destination
do
echo "\nContinue with the about selection ? (y/n) [Y]:\c"
read answer
if [[ $answer = [Yy] ]] || [[ -z $answer ]] ;then
break
elif [[ $answer = [Nn] ]] ;then
:
else
echo "\n Please answer y/n only !\n"
fi
done
trap 'echo “This operation may not be interrupted !”' 1 2 3 15
#now UNMIRROR rootvg
echo “\nNow unmirroring rootvg. This may take several minutes . . .\n” |tee –a $LOGFILE
unmirrorvg rootvg $DEST_DISK |tee –a $LOGFILE 2>&1
if [[ $? -ne 0 ]] ;then
echo "\nCan not unmirror rootvg to the destination disk $DEST_DISK" |tee –a $LOGFILE
exit 1
fi
# RUNNING bosboot FOR BOOT DISK
echo “\nNow running bosboot. This may take several minutes . . .” |tee –a $LOGFILE
bosboot -a -d /dev/$SOURCE_DISK |tee –a $LOGFILE 2>&1
if [[ $? -ne 0 ]] ;then
echo "\nCan not create bosboot on the source disk $SOURCE_DISK" |tee –a $LOGFILE
exit 1
fi
#BOOTLIST WILL BE DEFINED NOW
echo “\nNow removing the $DEST_DISK from the bootlist” |tee –a $LOGFILE
bootlist -m normal $SOURCE_DISK |tee –a $LOGFILE 2>&1
if [[ $? -ne 0 ]] ;then
echo "\nCan not remove the destination disk $DEST_DISK from the bootlist” |tee –a $LOGFILE
exit 1
fi
#Start REDUCEVG rootvg
echo “\nNow reducing the rootvg” |tee –a $LOGFILE
reducevg rootvg $DEST_DISK |tee –a $LOGFILE 2>&1
if [[ $? -ne 0 ]] ;then
echo "\nCan not reduce rootvg" |tee –a $LOGFILE
exit 1
fi
#QUORUM will be changed to on
echo “\nNow switching on the Quorum” |tee –a $LOGFILE
chvg -Q 'y' rootvg |tee –a $LOGFILE 2>&1
if [[ $? -ne 0 ]] ;then
echo "\nCan not switch on the Quorum on rootvg !” |tee –a $LOGFILE
exit 1
fi
trap - 1 2 3 15
echo “\nThe unmirroring of the system disk was successfully completed !\n” |tee –a $LOGFILE
echo “\nSee $LOGFILE for detailes !” |tee –a $LOGFILE
echo “###################################################################“ >> $LOGFILE
#If it’s 6F1 – use HOTSWAP manager to remove the disk, else – rmdev manually.
if [[ `uname -M|cut -d"-" -f2` = “6F1” ]] ;then
echo “\nAfter your next \”ENTER\” the $DEST_DISK disk will start blinking”
echo “\nPress ENTER when ready and wait for the instructions to replace the disk :\c”
read ANSWER
diag –c –d $DEST_DISK -T"identifyRemove –a remove"
cfgmgr
else
echo “”
echo ‘Please run ” rmdev –dl $DEST_DISK ” before removing the faulty disk !!!’
fi
echo “\n###################################################################“ |tee –a $LOGFILE
echo “\nThe unmirroring procedure was successfully completed !“ |tee –a $LOGFILE
echo “\n###################################################################“ |tee –a $LOGFILE
"Long live king Moshiach !"