Operating System - HP-UX
1753774 Members
7046 Online
108799 Solutions
New Discussion юеВ

Need script to generate volume groups from multiple disks / paths

 
Craig A. Sharp
Super Advisor

Need script to generate volume groups from multiple disks / paths

I am looking for a script that will take a comma delimited file of a list of disks that have primary and alternate paths and create a vg from the list. I have as many as 77 disks (SAN) that need to be included in the volume group. I dont really have time to write the script so I would appreciate some assistance. An example of the file would be:

/dev/rdsk/c14t0d4,/dev/rdsk/c18t0d4
/dev/rdsk/c14t0d5,/dev/rdsk/c18t0d5

The format I need for the vgcreate is the primaries then alternates:

vgcreate ..... /dev/rdsk/c14t0d4 /dev/rdsk/c14t0d5 /dev/rdsk/c18t0d4 /dev/rdsk/c18t0d5

I am hoping that someone has a script already that will do what I need. It can be more elaborate such as creating lvol, etc if thats what you have.

Thanks for all your help!

Craig
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: Need script to generate volume groups from multiple disks / paths

Shalom,

If you do this and a path goes out you lose the whole volume group.

Whats the problem with normal pvlinks

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Hein van den Heuvel
Honored Contributor

Re: Need script to generate volume groups from multiple disks / paths

Hmm,

Here is how I would glue file into a long list:

perl -lne 'chomp; push @x,split /,/}{print join " ",@x' input

But wait, you need the first element from the first, with the first from the second.

perl -ne 'chomp; push @a,[split /,/] }{ print "$a[0][$_] $a[1][$_] " for (0..$#{$a[0]}-1)' < two-lines > one-long-line

Here @a is an Array-of-Arrays.
See perl documentation perllol.
That }{ (eskimo kiss) ends the implied loop requested by -n and opens an 'end' block to be closed by the pending } from the -n.

try it?

Hein.
Hein van den Heuvel
Honored Contributor

Re: Need script to generate volume groups from multiple disks / paths

similar in awk...

awk -F, '{split($0,a); getline; n=split($0,b); while(i one-long-line

And... do heed SEP's advice.

Hein
Torsten.
Acclaimed Contributor

Re: Need script to generate volume groups from multiple disks / paths

77 LUNs sounds like overkill, but I don't know about your environment.

From the information you posted

"The format I need for the vgcreate is the primaries then alternates:

vgcreate ..... /dev/rdsk/c14t0d4 /dev/rdsk/c14t0d5 /dev/rdsk/c18t0d4 /dev/rdsk/c18t0d5"

It could be better to alternate primary and alternate links, like

/dev/rdsk/c14t0d4
/dev/rdsk/c18t0d4
/dev/rdsk/c18t0d5
/dev/rdsk/c14t0d5

This makes c14 as primary for the first, c18 as primary for the second - kind of balancing.

But anyway, much more details about hardware, software and requirements are needed ...


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!