Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file system creation in mirroed and non-mirrored VG 1

Status
Not open for further replies.

aixadm

MIS
May 11, 2005
28
US
Hello,
We have some 30 servers with some mirrored rootvgs and some unmirroed. I need to create a new file system on all these servers. So I was thinking of doing this using a script so it can create one LP on unmirrored rootvg and 2 LPs on mirrored rootvgs. Does anbody have any ideas how to start with this? The main thing is scripts needs to recoginise the rootvg whether it is mirrored or not.


Thanks
 
I use this script to check my mirrors, you should be able to amend it to you needs.

Code:
#! /bin/ksh -
#
VOLUMES=`lsvg -l rootvg | awk '{if ($5 == "2") print $1}'`
BROKEN=0
for volume in $VOLUMES
do
        lslv -m $volume | egrep -q 'hdisk0.*hdisk0|hdisk1.*hdisk1' && \
        BROKEN=1 && print "\nThe volume \"$volume\" is a broken mirror on node: `hostname | tr -s [a-z] [A-Z]`"
done

if [[ "$BROKEN" -eq "1" ]]
then
        print "\nUse \"lslv -m \$volume\" to inspect LP placement".
        print "Use \"reorgvg rootvg \$volume\" to fix these mirror problems."
fi

Mike

"A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant."

 

May be you can use this script. It makes assumptions that rootvg mirrored servers using hdisk0 and hdisk1, whereas rootvg unmirrored servers using hdisk0 only.

#!/usr/bin/ksh

if [ `lsvg -l rootvg | awk '{if ($5 == "2") print $1}'|wc -l` -gt 0 ]
then
echo "rootvg mirrored"
mklv -y newlv rootvg 1 hdisk0
mklvcopy newlv 2 hdisk1
syncvg -l newlv
crfs -v jfs -d /dev/newlv -m /newfs -A yes
sync
else
echo "rootvg not mirrored"
mklv -y newlv rootvg 1 hdisk0
crfs -v jfs -d /dev/newlv -m /newfs -A yes
sync
fi

Hope it helps.

aixnag
IBM Certified Specialist - P-series AIX 5L Administration
IBM Certified Specialist - AIX V4 HACMP
IBM eServer Certified Specialist – p690 Technical Support
IBM Certified Solutions Expert - DB2 UDB V7.1 Database Administration for Unix, Linux, Windows and OS/2
 
You can't really check if a volume group is mirrored, you can only check if all LVs in a volume group are mirrored

Mostly you can deduce that if your boot LV is mirrored, the whole VG is mirrored:

Code:
bootlv=$(lsvg -l rootvg|grep -w boot|awk '{print $1}')
copies=$(lslv ${bootlv}|grep -w COPIES:|awk '{print $2}')
p_disk=$(lslv -m hd5|tail +3|head -1|awk '{print $3}')
s_disk=$(lslv -m hd5|tail +3|head -1|awk '{print $5}')

if [ ${copies} -gt 1 ]
then
 # create lv with 2 copies on ${p_disk} and ${s_disk}
 mklv -c 2 -t jfs -y yourlvname rootvg ${p_disk} ${s_disk}
else
 # create lv with 1 copy on ${p_disk}
 mklv -c 1 -t jfs -y yourlvname rootvg ${p_disk}
fi

# create FS on the new LV
crfs -v jfs -d yourlvname -m /your/path/name -Ay -tn -prw


HTH,

p5wizard
 
Thanks Guys,Yes I have prepared a script to complete my tasks using your scripts and comments.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top