LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-24-2015, 09:33 AM   #1
Febi881
Member
 
Registered: Jun 2009
Location: India
Distribution: Fedora,Redhat
Posts: 111
Blog Entries: 1

Rep: Reputation: 17
Need a script to check Mirroring in consistencies


Dear Friends,

I was preparing a script to verify the mirroring consistencies on Linux servers. I was able to write a working one, but when I tested, I found a bug and right now I am running out of logic to fix it.

Set Up: Curretly we are using emc disks and disk name includes numbers 380 and 381 on a constant location in the name.

Eg: /dev/mpath/3600009700002957003801iet00010003
/dev/mpath/3600009700002957003811iet00010004


My script will grab 380 from mirror leg 0 and 381 from mirror leg 1
and if they are different then it will report a consistant mirror. Else it will report the issue and vice versa(in case of 381 on mirror leg 0 and 380 on leg 1).

My script is working fine when lvs and vgs having different names, But it is not, when we have same lv names on different vgs.

I have attached my script and a sample output of lvs -a -o +devices command output. Any suggestions are welcome to fix the issue.
Attached Files
File Type: txt check_mirror.txt (1.6 KB, 18 views)
File Type: txt command output.txt (4.6 KB, 10 views)
 
Old 11-25-2015, 03:07 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
On "lvs -a -o +devices " you could add specific VG so it does it only to the specific VG.

If you nested your existing commands within a larger loop you could do that dynamically and insure your script only seeing the LVs specific the VG the loop is currently processing. e.g.

Code:
for vg in $(vgs --noheadings |awk '{print $1}')
do lvs -a -o +devices $vg ... rest of line
   etc... (being sure to add the $vg to any lvs -a line you're doing)
done
I'm curious though. Are your EMC disks not already LUNs (RAID sets) defined within the EMC storage array itself? If so why do you need to mirror at host level? The main point of getting storage arrays is to let them handle the disk redundancy for you.

It sounds as if you're using mirroring in place of multipathing. The latter is designed to insure different paths to the same storage are combined. Since you're using mpath devices it appears you have multipathing turned on and if so each multipath device should be a combination of separate paths to the same disk from the storage array. Assuming that same disk is redundant within the array one mpath to each unique disk within the array should represent the various paths already so you shouldn't need to mirror 2 separate mpaths together.
 
Old 11-26-2015, 01:53 AM   #3
Febi881
Member
 
Registered: Jun 2009
Location: India
Distribution: Fedora,Redhat
Posts: 111

Original Poster
Blog Entries: 1

Rep: Reputation: 17
Quote:
Originally Posted by MensaWater View Post
On "lvs -a -o +devices " you could add specific VG so it does it only to the specific VG.

If you nested
Code:
for vg in $(vgs --noheadings |awk '{print $1}')
do lvs -a -o +devices $vg ... rest of line
   etc... (being sure to add the $vg to any lvs -a line you're doing)
done
Thank you so much for suggesting on this. I will modify my script accordingly and will test it.

Quote:
Originally Posted by MensaWater View Post
I'm curious though. Are your EMC disks not already LUNs (RAID sets) defined within the EMC storage array itself? If so why do you need to mirror at host level? The main point of getting storage arrays is to let them handle the disk redundancy for you.

It sounds as if you're using mirroring in place of multipathing. The latter is designed to insure different paths to the same storage are combined. Since you're using mpath devices it appears you have multipathing turned on and if so each multipath device should be a combination of separate paths to the same disk from the storage array. Assuming that same disk is redundant within the array one mpath to each unique disk within the array should represent the various paths already so you shouldn't need to mirror 2 separate mpaths together.
These are old systems and set up has been done very long back. So no one want us co change anything on this. Yes I am completely agreeing with you on RAID part and most of the EMC storage clusters have been configured with that. We already recommended to use the RAID as a cost effective mechanism to avoid disk failures and they do not agree with that. Here, what my script is trying to do is nothing but to avoid the manual errors during mirror extensions like reattaching a combination of different disks from different data centres on same mirror leg.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script to check if file is present or not, check periodically every 30 mins Iyyappan Linux - Server 10 07-03-2013 05:19 AM
Script to check PID from file and check whether process is running or not rajkiran183 Linux - Newbie 5 10-19-2012 11:28 AM
How to check that my script can check if it has a specific range of charcters. shirlcurl20 Linux - Newbie 2 11-16-2010 11:15 PM
Please Check Script ehegagoka Slackware 3 02-13-2007 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration