Operating System - HP-UX
1827687 Members
3676 Online
109967 Solutions
New Discussion

primary alternate path script.

 
RedLetter
Advisor

primary alternate path script.

Just looking for a script that checks to see if the paths are balanced. Also looking for a script to run if you need to balance the paths.

History: we build our VG's alternating between channels. But, on occasion, a path will fail and LVM adjusts to address this. However, once tha path becomes available again, LVM doesnt always fail back as hoped.

Therefore, I am hoping someone else has seen this and has written a script to alert on this condition, as well as simplify the resolution. I was told about a switchpath script, but couldnt find anything relating to it on itrc. Thanks,
Wondeful, never had it so good...
3 REPLIES 3
Sridhar Bhaskarla
Honored Contributor

Re: primary alternate path script.

Hi,

Attached is one script I wrote long back that uses sar output and prints the %utililzation of each path. It may not give accurate information but gives a good idea on how the controllers are balanced.

As you said before, you don't need any script to switch the paths. As long as your /etc/lvmtab is defined correctly, the paths will switch back after the physical volumes are available again. I usually do the following to switch the alternate and primary paths. If your vg contains say c0t0d0, c0t1d0 with alternates c1t0d0 and c1t1d0, then

#vgreduce vgxx /dev/dsk/c0t1d0
#vgextend vgxx /dev/dsk/c0t1d0

will make c1t1d0 as the primary path.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
RedLetter
Advisor

Re: primary alternate path script.

Thanks, A more detailed example of what we see on occasion is:

a VG should have a balance of 8 primary and 8 alternate. Sometimes we see an imbalance of 10 and 6.

I have a clunky script way of getting this information, but was hoping to see if anyone spent more time on it. Noting: The VG's where created in a balanced in the first place.

I create an input file per VG and that doesnt include any PVG data. I then use this command to test the primary alternate pairs.

grep /c7 Prialtlink_list|grep Alt|wc -l

I also was hoping for a script that autobalance using the pvchange -s option.

One of our HP reps told me about a script I think was called "switch paths" or something.

Anyone know anything about that. Thanks,
Wondeful, never had it so good...
Sridhar Bhaskarla
Honored Contributor

Re: primary alternate path script.

Hi,

Since you have defined PVGs, you will need to parse out the information contained in the physical volume groups area of 'vgdisplay' command.

I would tend to write a small script that will do it for you. For ex.,

num_PRI=$(vgdisplay -v vgHDSAPP04 |sed -n '/--- Physical volumes ---/,/--- Physical volume groups ---/p' |grep "PV Name" |grep -v Alternate|wc -l)

num_ALT=$(vgdisplay -v vgHDSAPP04 |sed -n '/--- Physical volumes ---/,/--- Physical volume groups ---/p' |grep "PV Name" |grep Alternate|wc -l)

You can compare the above two and find the difference to see if all the alternate paths have been defined.

pvchange -s is to temporarily switch the paths. It will not sustain a reboot. You can probably write a script that goes into loop, checks for the load balance and alter tne paths accordingly. But the danger is if one PV is heavily utilized, your script will keep on switching the paths.

You can get good loadbalancing if you striped the logical volumes. If there are 4 disks in the stripe, you can define two with one path and other two with another path.

For true loadbalancing, you will need to use softwares like autopath, powerpath etc.,

-Sri
You may be disappointed if you fail, but you are doomed if you don't try