This is a discussion on script needed to identify unmirrored logical volumes within the AIX Operating System forums, part of the Unix Operating Systems category; --> Hi all. Can someone donate a script? We do logical volume mirroring and I would like to have a ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi all. Can someone donate a script? We do logical volume mirroring and I would like to have a fast way to verify all of our logical volumes are mirrored. This is necessary because we have a database that uses raw devices and we frequently have DBAs creating raw space/LVs for the database and sometimes they forget to mirror them. Before anyone says it, I know this would be simpler if I mirrored at the hardware level, but I am stuck with what we have. Thanks in advance! |
| |||
| lsvg -l datavg PVs should be 2. When DBAs create LVs they should indicate which hard disk so that LPs would not spill over to the other hard disk and that there should be no cross mapping. emebohw@netscape.net (sumGirl) wrote in message news:<a5e13cff.0409201434.43b4a5ca@posting.google. com>... > Hi all. Can someone donate a script? We do logical volume mirroring > and I would like to have a fast way to verify all of our logical > volumes are mirrored. This is necessary because we have a database > that uses raw devices and we frequently have DBAs creating raw > space/LVs for the database and sometimes they forget to mirror them. > > Before anyone says it, I know this would be simpler if I mirrored at > the hardware level, but I am stuck with what we have. > > Thanks in advance! |
| |||
| not necassarily true. PV=2 only implies 2 physical volume are used for the LV, and NOT that they are mirrored. Better approach would be to examine each the physical discs per LV, ala $ cat mirrorCheck.ksh #!/usr/bin/ksh # # script to report UNMIRRORED LVs # # gwally 9-Oct-04 printf "%-15s" "VOL GRP" printf "%-21s" "Logical Vol" printf "%-15s" "Status" for i in $(lsvg) # gather LVs on system do for j in $(lsvg -l ${i}|grep jfs|awk '{print $1}') # gather lists of LVs per VG do if [ $(lslv ${j}|grep "COPIES"|awk '{print $2}') -lt 2 ] then printf "%-15s" "${i}" printf "%-21s" "${j}" printf "%-15s" "is NOT Mirrored" #print "VG: ${i} LV: ${j} is NOT MIRRORED" fi done done SAMPLE OUTPUT: VOL GRP Logical Vol Status rootvg hd8 is NOT Mirrored rootvg hd4 is NOT Mirrored rootvg hd2 is NOT Mirrored rootvg hd9var is NOT Mirrored rootvg hd3 is NOT Mirrored rootvg hd1 is NOT Mirrored |
| |||
| Actually, the easiest way is using "lsvg -l vgname" such as following: lsvg -l rootvg rootvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT hd5 boot 1 2 2 closed/syncd N/A hd6 paging 320 320 1 open/syncd N/A paging00 paging 320 320 1 open/syncd N/A hd8 jfslog 1 2 2 open/syncd N/A hd4 jfs 17 34 2 open/syncd / hd2 jfs 149 298 2 open/syncd /usr hd9var jfs 2 4 2 open/syncd /var hd3 jfs 32 64 2 open/syncd /tmp hd1 jfs 1 2 2 open/syncd /home ^ ^ | | you can see from the LPs and PPs, if the PPs are double as LPs, the LV must be mirrored. "charter" <gw@charter.net> wrote in message news:<10mgnbh6qoq1621@corp.supernews.com>... > not necassarily true. PV=2 only implies 2 physical volume are used for the > LV, and NOT that they are mirrored. > Better approach would be to examine each the physical discs per LV, ala > > $ cat mirrorCheck.ksh > #!/usr/bin/ksh > # > # script to report UNMIRRORED LVs > # > # gwally 9-Oct-04 > printf "%-15s" "VOL GRP" > printf "%-21s" "Logical Vol" > printf "%-15s" "Status" > for i in $(lsvg) # gather LVs on system > do > for j in $(lsvg -l ${i}|grep jfs|awk '{print $1}') # gather > lists of LVs per VG > do > if [ $(lslv ${j}|grep "COPIES"|awk '{print $2}') -lt 2 ] > then > printf "%-15s" "${i}" > printf "%-21s" "${j}" > printf "%-15s" "is NOT Mirrored" > #print "VG: ${i} LV: ${j} is NOT MIRRORED" > fi > done > done > > > > SAMPLE OUTPUT: > VOL GRP Logical Vol Status > rootvg hd8 is NOT Mirrored > rootvg hd4 is NOT Mirrored > rootvg hd2 is NOT Mirrored > rootvg hd9var is NOT Mirrored > rootvg hd3 is NOT Mirrored > rootvg hd1 is NOT Mirrored |
| |||
| sure that's the case in MOST instances, but not in all....see below: $ lsvg -l rootvg|grep hd2 hd2 jfs 108 216 5 open/syncd /usr $ lslv -l hd2 hd2:/usr PV COPIES IN BAND DISTRIBUTION hdisk3 092:000:000 69% 000:000:064:028:000 hdisk0 064:000:000 100% 000:000:064:000:000 hdisk5 016:000:000 0% 000:000:000:016:000 hdisk34 020:000:000 0% 020:000:000:000:000 hdisk35 024:000:000 100% 000:000:024:000:000 -- ---------------------------------------------------- This mailbox protected from unsolicited email by Spam X-terminator from StompSoft http://www.stompsoft.com "duoduo" <duoduo.deng@gmail.com> wrote in message news:d3c653d9.0410100140.5c4b7036@posting.google.c om... > Actually, the easiest way is using "lsvg -l vgname" such as following: > > lsvg -l rootvg > rootvg: > LV NAME TYPE LPs PPs PVs LV STATE MOUNT > POINT > hd5 boot 1 2 2 closed/syncd N/A > hd6 paging 320 320 1 open/syncd N/A > paging00 paging 320 320 1 open/syncd N/A > hd8 jfslog 1 2 2 open/syncd N/A > hd4 jfs 17 34 2 open/syncd / > hd2 jfs 149 298 2 open/syncd /usr > hd9var jfs 2 4 2 open/syncd /var > hd3 jfs 32 64 2 open/syncd /tmp > hd1 jfs 1 2 2 open/syncd /home > ^ ^ > | | > > you can see from the LPs and PPs, if the PPs are double as LPs, the LV > must be mirrored. > > > "charter" <gw@charter.net> wrote in message news:<10mgnbh6qoq1621@corp.supernews.com>... > > not necassarily true. PV=2 only implies 2 physical volume are used for the > > LV, and NOT that they are mirrored. > > Better approach would be to examine each the physical discs per LV, ala > > > > $ cat mirrorCheck.ksh > > #!/usr/bin/ksh > > # > > # script to report UNMIRRORED LVs > > # > > # gwally 9-Oct-04 > > printf "%-15s" "VOL GRP" > > printf "%-21s" "Logical Vol" > > printf "%-15s" "Status" > > for i in $(lsvg) # gather LVs on system > > do > > for j in $(lsvg -l ${i}|grep jfs|awk '{print $1}') # gather > > lists of LVs per VG > > do > > if [ $(lslv ${j}|grep "COPIES"|awk '{print $2}') -lt 2 ] > > then > > printf "%-15s" "${i}" > > printf "%-21s" "${j}" > > printf "%-15s" "is NOT Mirrored" > > #print "VG: ${i} LV: ${j} is NOT MIRRORED" > > fi > > done > > done > > > > > > > > SAMPLE OUTPUT: > > VOL GRP Logical Vol Status > > rootvg hd8 is NOT Mirrored > > rootvg hd4 is NOT Mirrored > > rootvg hd2 is NOT Mirrored > > rootvg hd9var is NOT Mirrored > > rootvg hd3 is NOT Mirrored > > rootvg hd1 is NOT Mirrored |
| |||
| charter wrote: > sure that's the case in MOST instances, but not in all....see below: > > $ lsvg -l rootvg|grep hd2 > hd2 jfs 108 216 5 open/syncd /usr > > $ lslv -l hd2 > hd2:/usr > PV COPIES IN BAND DISTRIBUTION > hdisk3 092:000:000 69% 000:000:064:028:000 > hdisk0 064:000:000 100% 000:000:064:000:000 > hdisk5 016:000:000 0% 000:000:000:016:000 > hdisk34 020:000:000 0% 020:000:000:000:000 > hdisk35 024:000:000 100% 000:000:024:000:000 > > > > Not sure what you wanted us to see here. This could be ok or not ok - there's not enough information to tell. Could be that it's hdisk3+hdisk5 mirrored to hdisk0+hdisk34+hdisk35 or it could be that hdisk2 has 46 LPs of hd2 mirrored onto itself. The point is that such a script should make check that (a) each LP has >2 PPs and (b) at least two different PVs are used for each LP. You might want to tighten that up into each LP maps onto two PPs each on different PVs. |
| |||
| "charter" <gw@charter.net> wrote in message news:<10mk2k61ck62830@corp.supernews.com>... > sure that's the case in MOST instances, but not in all....see below: > > $ lsvg -l rootvg|grep hd2 > hd2 jfs 108 216 5 open/syncd /usr > > $ lslv -l hd2 > hd2:/usr > PV COPIES IN BAND DISTRIBUTION > hdisk3 092:000:000 69% 000:000:064:028:000 > hdisk0 064:000:000 100% 000:000:064:000:000 > hdisk5 016:000:000 0% 000:000:000:016:000 > hdisk34 020:000:000 0% 020:000:000:000:000 > hdisk35 024:000:000 100% 000:000:024:000:000 Your LV hd2 is screwed up... LP --> PP mapping is 1:1 unless the LP is Mirrored then its 1:2 or 1:3 .. yours is 1:2 with no mirroring i.e. its screwed. see page 2. fig 2. and the Whole of Chapter 2 "Mirroring" of "A to Z Logical Volume Manager Intro and Concepts" Redbook SG24-5432-00 Rgds Mark Taylor |
| ||||
| Best method is getlvcb (get informations about Logical Volume Control Block), for all informations you can use "getlvcb -TA <lvname>": # />getlvcb -TA hd1 AIX LVCB intrapolicy = c copies = 2 interpolicy = m lvid = 005f828a00004c00000000f81a521150.8 lvname = hd1 label = /home machine id = FA81A4C00 number lps = 1 relocatable = y strict = y stripe width = 0 stripe size in exponent = 0 type = jfs upperbound = 32 fs = time created = Wed Oct 8 06:11:23 2003 time modified = Wed Oct 15 10:33:00 2003 If you only want to know if mirrored use "getlvcb -c <lv name>" if returned int is >1 then logical volume is mirrored: # />getlvcb -c hd1 2 Best regards, Carmine. emebohw@netscape.net (sumGirl) wrote in message news:<a5e13cff.0409201434.43b4a5ca@posting.google. com>... > Hi all. Can someone donate a script? We do logical volume mirroring > and I would like to have a fast way to verify all of our logical > volumes are mirrored. This is necessary because we have a database > that uses raw devices and we frequently have DBAs creating raw > space/LVs for the database and sometimes they forget to mirror them. > > Before anyone says it, I know this would be simpler if I mirrored at > the hardware level, but I am stuck with what we have. > > Thanks in advance! |