1863043 Members
1203 Online
110446 Solutions
New Discussion

Re: script help please

 
SOLVED
Go to solution
John Poff
Honored Contributor

Re: script help please

Hi,

The 'basename' and 'dirname' commands are Unix commands that extract portions of path names. Here is an example:

# basename /dev/vg043data/lvol1
lvol1
# dirname /dev/vg043data/lvol1
/dev/vg043data


The 'basename' command gives us a cheap way to extract just the logical volume name from the full logical volume name. The 'dirname' command also gives us an easy way to build the raw logical volume name.

I looked through the script and I did find one bug. I was doing a string comparison on the PEs as the volume group gets extended. Try changing this line:

while ((VGPECOUNT < TOTALPE))

to this:

while [[ VGPECOUNT -lt TOTALPE ]]


I probably got lucky and it worked with the string comparison, but it really should compare the expressions instead. The function that figures out the next minor number for the vgcreate also has this bug. I want to re-write that function anyway as it just counts in decimal and the minor numbers are incremented in hex, so it could trip up in certain cases [with more than ten volume groups, it will calculate minor numbers as 08, 09, 10, 11 ... instead of 09, 0a, 0b. Oops!]


Your config file for the vg043bin volume group didn't have filesystem mount points listed for lvol8 and lvol15. Do those lvols have real mountpoints? If so, you might want to either re-run the 'build_vg_conf' script or else just edit the vg043bin.config file to make sure it has valid mount points. I probably need to work on making the 'build_vg_conf' script [and 'recreate_vg'] a little more robust.

Let me know what you find.

JP
John Meissner
Esteemed Contributor

Re: script help please

in the file vg043bin - the 2 lvols in question aren't mounted... I removed them manually from the file and ran it again the other day. Before I make the above mentioned changed you suggested... I tried everything and it all seems to work - except creating the lvols.... when I go to /dev/vg043bin the only file I see it the group file... I don't see any of the lvol files that "should" be there. I did change the fstab options to automatically write to a file though... it writes to ftab.tmp... which I'll attach here just so you can see that things are comming along.
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: script help please

John - also in your statement:

while ((VGPECOUNT < TOTALPE))

whould the VGPECOUNJT and TOTALPE have $ in front and read as

while (($VGPECOUNT < $TOTALPE))
??
i'm just curious.
All paths lead to destiny
John Poff
Honored Contributor

Re: script help please

I think that there may still be a problem with the 'vgcreate'. All the 'lvcreate' lines would fail if the VG doesn't get created successfully. That is one of the things about the script that I need to harden. Luckily, I'm supposed to get a loaner test server in today that I'll have to setup, and I'll probably get a little time to harden the 'recreate_vg' script and test it out. For some reason they get nervous about me running a script that will do lots of 'pvcreate -f' and vgcreates!

As for the test you mentioned, I tried it and it works both ways, with or without the dollar sign in front of the variables. I've got to read up some more on expressions and tests to understand why it does that, but in a little test script I wrote it worked either way.

JP
John Meissner
Esteemed Contributor

Re: script help please

I know what you mean about nervous. fortunately I have 2 test boxes that I can play around with as much as I like.

So you think the problem is in the vgcreate? That would explain with the lvcreate didn't work properly. Interesting how it still created all the necessary fstab entries (my earlier attached file)

I want to thank you for all your help John.... When this is all over I'll have to get your contact info and send you a big box of candy (I work for M&M Mars). Thanks for all your help so far. This will literally save me hours of work at our disaster recovery tests.
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: script help please

I think one thing that might be causing problems for me is the function list_physical_volumes

when I run it the way you have it it is bringing up some values that cause errors. when I do a vgscan it reports the following:

# vgscan
vgscan: Couldn't access the list of physical volumes for volume group "/dev/build_vg".
vgscan: The physical volume "/dev/dsk/c1t6d0" is already recorded in the "/etc/lvmtab" file.
vgscan: The physical volume "/dev/dsk/c2t6d0" is already recorded in the "/etc/lvmtab" file.
Physical Volume "/dev/dsk/c0t2d0" contains no LVM information
Physical Volume "/dev/dsk/c3t0d0" contains no LVM information
Physical Volume "/dev/dsk/c3t4d6" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t4d7" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t5d0" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t6d2" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t6d3" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t6d4" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t6d5" is not part of a Volume Group
Physical Volume "/dev/dsk/c3t6d6" is not part of a Volume Group

The two entries that comes back with: contains no LVM informationome
are being used in the script... I think that I need to get rid of these entries... is the best way to do this to re-write that function using the output from vgscan instead of the current way?
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: script help please

ignore the above post... it's not using the bad physical volumes that vgscan is showing me. (you should only read every other post i put up here appearantly)
All paths lead to destiny
John Poff
Honored Contributor

Re: script help please

Hi John,

Part of the problem might be that one of the earlier runs of the 'recreate_vg' script used a bogus .config file and created a volume group named /dev/build_vg. I'd suggest doing a vgexport on that build_vg volume group. I think if you can get your test system cleaned up from the earlier runs of the script you might be in business. Since it is your test box, you could just vgexport all the VGs except for vg00 if all you are doing is testing the 'recreate_vg' script on this box.

There is a command line option for the 'recreate_vg' script that allows you to pass a file with a list of PVs for it to use. The '-m' option will do this, and you give it a file name containing the list of PVs. I added that option so that you can build your own list of PVs to pass to the script. It expects the PVs to be in the form of '/dev/dsk/cXtYdZ'.

As for the candy, wow! You don't have to do that, but I have always been a firm believer that with enough refined sugar and caffeine in my blood anything is possible!

JP
John Meissner
Esteemed Contributor

Re: script help please

I think you made a valid point about a previous attempt... yesterday we re-ignited the box and tried your script again. this time things went MUCH better. the only thing is that it did everything for the 1st config file... and didn't do much for the 2nd config file. the 1st config file it did everything except create the directories for the mount points. not a big deal. we can always do that manually.
I'm not sure why it didn't do anything for the second file... i vi'd them both and checked them for correctness.
We ignited the server again after this to try fresh and see what happens... .unfortunately I'm in a global team meeting all day (what fun :) ) but I'll hopefully get to spend all day tomarrow working on it. As for the Candy I'd be more than happy to ship you a box stocked with some of our product...
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: script help please

Hey John - This past week was bogged down in meetings for me. I wasn't able to spend much time working on the script. Did you have any luck on your test machine? You said something about the vgcreate was having problems on your end I think. Anyway I just thought I'd see if you made any progress.

Hope to hear from you soon
All paths lead to destiny
John Poff
Honored Contributor

Re: script help please

Hi John,

I finally got my test machine in and I had lots of fun with it. Crazy errors with the box that turned out to be bad RAM. I had to waste so much time chasing that problem that I didn't get a chance to use the script on it. There are more new boxes on the way here, so maybe I can get one for a bit to test the script.

Let me give you my e-mail address so you can reach me here. It is jpoff at familydollar dot com. You don't have to post your e-mail address. Just send me an e-mail and I'll get it that way. At least only one of us needs to worry about the spam! :)

JP
John Meissner
Esteemed Contributor

Re: script help please

thanks John - love the "at" and "dot" hopefully that keeps the spam off. Anyway I sent you an e-mail just so you'd have mine as well.
All paths lead to destiny
John Meissner
Esteemed Contributor

Re: script help please

Ok - I feel reeeeaaaaalllllyyyy dumb for this one....

Here's the solution -
use John's script - It works perfectly! :)

BUT BEFORE YOU DO - check to see you have enough EMC disk to recreate the volume groups correctly ...... the server i was recovering had more EMC than the server I was recovering to. I spent a week trying to get it to work on my server before I finially noticed this.

Much Thanks John! :)
All paths lead to destiny