Adding alt PV links to VG

 
Ra Jose
Regular Advisor

Adding alt PV links to VG

I am wondering why doesn't LVM add alt PV links automatically when a VG is created with only primary PV link. E.g. c17t4d5 and c21t4d5 are 2 paths to same SAN device. If I do,
# vgcreate vgTEST /dev/dsk/c17t4d5
# vgdisplay -v vgTEST | grep "PV Name"
shows only /dev/dsk/c17t4d5. It does not automatically add the alt link. It has to be added manually. Is it designed this way? If so, is there any way to have LVM automatically discover the alt link and add to the VG.

The reason I am asking is, I have several VGs which have only one path showing is vgdisplay.
I need to add alt links to all these VGs. Rather than going thru scripting or manul procedures, is there any option in LVM to do it.

Thank you all for your replies.

Rajos
7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: Adding alt PV links to VG

It is not added because you didn't tell it to add it.

There is no way I know of to do it automatically. You have to manually, or via a script, vgextend to add the alternate paths to each VG.
Sundar_7
Honored Contributor

Re: Adding alt PV links to VG

Rajos,

No, LVM doesn't do it for you automatically. Unfortunately, you will have to manually add all the paths to the VG.

But if you have any of the MPIO softwares installed (like powerpath or securepath), it doesnt matter how many paths you added to the volume group, the MPIO sw will take care of load balancing.

One more thing to keep in mind while adding the alternate links manually is load balancing. You want to alternate between the cluster ports (CL1 and CL2 incase of XP) so that the IO is load balanced.

Do remember, with LVM, the IO is only through the primary link. Rest of the links are only standby (i.e active-standby configuration).

Hope this helps

Sundar.
Learn What to do ,How to do and more importantly When to do ?
Matti_Kurkela
Honored Contributor

Re: Adding alt PV links to VG

If you can temporarily unmount all the filesystems in the VG and deactivate the VG, you could export and re-import the VG using the "-s" option of vgexport and vgimport.

This option will store the VGID into the map file when exporting a VG, and when importing, it will go through all disks visible to the system looking for that VGID. The first matching device becomes the primary path, and all others with the same PVID (=other paths to the same PV) automatically become alternate paths. If the VG contains many PVs, this is automatically repeated for each PV in the VG.

MK
MK
Ra Jose
Regular Advisor

Re: Adding alt PV links to VG

Thank you all. Unfortunately since LVM did not have the facility, I had to write a small awk/shell script to find which VGs have no alt link, find alt link and add it.

# vgdisplay -v | grep "PV Name" >> pvf
Use awk, cut so that the contents of pvf look
like below :
# cat pvf
/dev/dsk/c6t5d5
/dev/dsk/c11t6d0 Alternate Link
/dev/dsk/c6t5d6
/dev/dsk/c11t6d1 Alternate Link
/dev/dsk/c17t2d7
/dev/dsk/c18t2d7 Alternate Link
/dev/dsk/c7t6d2
/dev/dsk/c6t9d6
/dev/dsk/c11t9d6 Alternate Link
/dev/dsk/c6t14d2
/dev/dsk/c11t14d2 Alternate Link
/dev/dsk/c7t5d6
/dev/dsk/c6t14d3
/dev/dsk/c11t14d3 Alternate Link
# cat pvf.awk # little awk script
NF ~ /1/ { if ( FLAG == 1 ) print SAVE; FLAG=1; SAVE=$1 }
NF ~ /3/ { FLAG=0 }
# awk -f pvf.awk pvf # run and device which dont have alt links are displayed.
/dev/dsk/c7t6d2
/dev/dsk/c7t5d6

Rajos
Torsten.
Acclaimed Contributor

Re: Adding alt PV links to VG

You did not mention your OS version, but it looks like it is not 11.31, because:

"There is a new feature introduced in the Mass Storage Subsystem on this version of HP-UX that also supports multiple paths to a device and allows access to the multiple paths simultaneously. The Mass Storage Subsystem will balance the I/O load across the valid paths. This new multi-path behavior is enabled and disabled through the use of the scsimgr command. See scsimgr(1M) for details.

It is no longer required or recommended to configure LVM with alternate links"

see
http://docs.hp.com/en/B2355-60130/vgextend.1M.html

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Ra Jose
Regular Advisor

Re: Adding alt PV links to VG

Thank you Torsten. The OS version is 11iv2 (11.23).
Ra Jose
Regular Advisor

Re: Adding alt PV links to VG

Thank you