Need help in scripting to check if rootvg is mirrored or not | Unix Linux Forums | AIX

  Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

Need help in scripting to check if rootvg is mirrored or not

AIX


Tags
aix, unix

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-31-2013
newtoaixos newtoaixos is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 29 August 2014, 9:12 AM EDT
Location: Bangalore
Posts: 84
Thanks: 29
Thanked 0 Times in 0 Posts
Need help in scripting to check if rootvg is mirrored or not

Hi

Can some one help me with a script which when executed will check and tell if all the LV's in rootvg are mirrored or not. Say for example in the below server we could see that everything is mirrored except dumplv2. So if I execute the script it should tell that all are mirrored except dumplv2.

Please assist with the script.


Code:
BMUT8# 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         4       8       2    open/syncd    N/A
fslv37              jfs2            18      36      2    open/syncd    /usr/sap/DAA
paging01            paging      160     320     2    open/syncd    N/A
hd8                 jfs2log         1       2       2    open/syncd    N/A
hd4                 jfs2             2       4       2    open/syncd    /
hd2                 jfs2             27      54      2    open/syncd    /usr
hd9var              jfs2            3       6       2    open/syncd    /var
hd3                 jfs2            11      22      2    open/syncd    /tmp
hd1                 jfs2             1       2       2    open/syncd    /home
hd10opt             jfs2           3       6       2    open/syncd    /opt
fslv01              jfs2             1       2       2    open/syncd    /var/log
fslv02              jfs2             1       2       2    open/syncd    /usr/local
fslv03              jfs2             3       6       2    open/syncd    /opt/patrol
lg_dumplv           sysdump    9       9       1    open/syncd    N/A
hd11admin           jfs2          1       2       2    open/syncd    /admin
fslv04              jfs2             7       14      2    open/syncd    /opt/oscdtws1
dumplv2             sysdump    9       9       1    open/syncd    N/A

Sponsored Links
    #2  
Old 02-01-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 23 October 2014, 11:38 AM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,286
Thanks: 45
Thanked 824 Times in 651 Posts
Quote:
Originally Posted by newtoaixos View Post
Can some one help me with a script which when executed will check and tell if all the LV's in rootvg are mirrored or not.
Of course. Just post what you have tried and we will correct it until it works.

bakunin
Sponsored Links
    #3  
Old 02-01-2013
-=XrAy=- -=XrAy=- is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 23 September 2014, 10:46 AM EDT
Location: D:\Rheinland-Pfalz\Koblenz
Posts: 93
Thanks: 4
Thanked 19 Times in 17 Posts
snip:

Code:
#!/usr/bin/ksh
TMP_FILE=/tmp/mirror_check.out
if (( $(lspv| grep -cw rootvg) > 1 )); then
        lsvg -l rootvg | awk 'NR > 2 && $2 !~ /^sysdump$/ { if ($3 == $4) {print $0} }' >> $TMP_FILE
        NON_MIRR=`wc -l < $TMP_FILE`
        if (( $NON_MIRR != 0 )); then
                echo "unmirrored LVs found:"
                echo
                cat $TMP_FILE
        fi
fi

The original code was written by zaxxon.
Thank Him not me
    #4  
Old 02-01-2013
ctsgnb ctsgnb is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 October 2014, 9:32 AM EDT
Location: France
Posts: 2,930
Thanks: 81
Thanked 624 Times in 596 Posts
Non mirrored LV whose $2 is "sysdump" are not displayed, this is normal (the script as been coded to behave this way)
Sponsored Links
    #5  
Old 02-01-2013
MichaelFelt MichaelFelt is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 11 December 2013, 7:33 AM EST
Location: on the road for work; home is private time
Posts: 311
Thanks: 6
Thanked 76 Times in 71 Posts
long ago it was ok to not mirror sysdump/hd6 BUT AIX will dump to mirrorred device - so that even on a reboot on a single copy after a dump, the dump is there.
i.e. better practice to mirror imho
Sponsored Links
    #6  
Old 02-01-2013
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 23 October 2014, 11:38 AM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,286
Thanks: 45
Thanked 824 Times in 651 Posts
Moderative Interlude

Moderator's Comments:
First of all, I'd like to thank everybody who has tried to help. In fact this is why we write here and UNIX wouldn't be UNIX without the long-standing tradition of one helping the other and constant discussion of every aspect of our work. I'm thankful for every of you being here.

Still, it is also a long-standing tradition that "help" in our part of the society means "help to help yourself". This means: the one seeking help should show some genuine effort first to solve his problem. The thread-opener did no such thing. And there is also a long-standing tradition inherited from countless newsgroups in the comp.* hierarchy to ignore people who don't uphold this tenet.

I'd like to ask you therefore to NOT answer such threads - not until O/P has shown this genuine effort by presenting whatever he has undertaken to accomplish his task. This was exactly the point of my answer. Please hold back on such threads until O/P has answered - and if he doesn't bother to do so, then so be it.

We are all professionals here and - like me - you probably met one or the other "colleague" in your career who tried to let others do his work. You perhaps do not want to support or encourage persons once they cannot get favours from their immediate co-workers any more, do you?

So, please, use your judgement and refrain from answering threads as long as O/P has not shown some willingness to work himself before.

Thank you for your consideration.

bakunin
The Following 5 Users Say Thank You to bakunin For This Useful Post:
newtoaixos (11-03-2013), ross.mather (02-01-2013), vbe (02-01-2013), vgersh99 (02-01-2013), zaxxon (02-02-2013)
Sponsored Links
    #7  
Old 02-02-2013
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 23 October 2014, 10:31 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,237
Thanks: 121
Thanked 453 Times in 412 Posts
Xray didn't know it - will send him a PM to be a tad more sensible next time. But you are absolutely right Bakunin. That's the way to go.

Last edited by zaxxon; 02-02-2013 at 01:31 PM.. Reason: spelling
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rootvg mirrored newtoaixos AIX 1 05-24-2012 01:27 PM
Help scripting to start, check, and restart processes MacG32 Shell Programming and Scripting 12 06-24-2011 02:59 PM
Scripting to check the size of file and it's existance. amitkumar.b2 Shell Programming and Scripting 1 06-06-2011 06:47 AM
New to Shell scripting: Can you check it? sapient Shell Programming and Scripting 11 10-29-2008 06:02 PM
SQL Connection check though Scripting Swapna173 UNIX for Dummies Questions & Answers 2 08-20-2008 04:16 AM



All times are GMT -4. The time now is 02:32 PM.