Operating System - HP-UX
1748228 Members
4688 Online
108759 Solutions
New Discussion юеВ

Re: can't found the VGID from a disk

 
SOLVED
Go to solution
mobidyc
Trusted Contributor

can't found the VGID from a disk

Hello,

normally, i can guess the VG of a disk by the followings command.

recuperate the VGID list:
#################################
#> strings -t d /etc/lvmtab |grep /dev |grep -v /dev/dsk |sort -k 2 |while read offset vg ; do
xd -An -j$(($offset+1024)) -N8 -tuL /etc/lvmtab |read v1 v2
printf "%-15s %x%x\n" ${vg##*/} ${v1} ${v2}
done

vg00 d7a29712449bc7a3
vgdata d7a29712449ff9e9
#################################

recuperate the VGID of a disk:
#################################
#> for i in $(ioscan -funC disk |grep -i dsk |awk '{print $1}')
do echo "$i: \c" ; echo 0x2010?2X |adb $i
done

/dev/dsk/c2t1d0: 2010: 0xD7A29712 449BC7A3
/dev/dsk/c3t0d0: 2010: 0xD7A29712 449BC7A3
/dev/dsk/c6t0d0: 2010: 0xD7A29712 449FF9E9
/dev/dsk/c6t0d1: 2010: 0xD7A29712 449FF9E9
/dev/dsk/c6t0d2: 2010: 0 0
/dev/dsk/c7t0d0: 2010: 0xD7A29712 449FF9E9
/dev/dsk/c7t0d1: 2010: 0xD7A29712 449FF9E9
/dev/dsk/c7t0d2: 2010: 0 0
#################################

the last field is the VGID.

for some unknown reasons i can't obtain this VGID from a disk - (plus its alternate path) - and i really don't know why.

here is my configuration:
#> model
9000/800/rp4440
#> uname -a
HP-UX nr0u0264 B.11.11 U 9000/800 3617756946 unlimited-user license
#> ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
===========================================================================
disk 0 0/0/3/0.0.0.0 sdisk CLAIMED DEVICE TEAC DV-28E-C
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0
disk 1 0/1/1/0.1.0 sdisk CLAIMED DEVICE HP 36.4GST336753LC
/dev/dsk/c2t1d0 /dev/rdsk/c2t1d0
disk 2 0/1/1/1.0.0 sdisk CLAIMED DEVICE HP 36.4GST336753LC
/dev/dsk/c3t0d0 /dev/rdsk/c3t0d0
disk 3 0/2/1/0.13.0.0.0.0.0 sdisk CLAIMED DEVICE DGC CX700WDR5
/dev/dsk/c6t0d0 /dev/rdsk/c6t0d0
disk 5 0/2/1/0.13.0.0.0.0.1 sdisk CLAIMED DEVICE DGC CX700WDR5
/dev/dsk/c6t0d1 /dev/rdsk/c6t0d1
disk 7 0/2/1/0.13.0.0.0.0.2 sdisk CLAIMED DEVICE DGC CX700WDR5
/dev/dsk/c6t0d2 /dev/rdsk/c6t0d2
disk 4 0/6/1/0.13.12.0.0.0.0 sdisk CLAIMED DEVICE DGC CX700WDR5
/dev/dsk/c7t0d0 /dev/rdsk/c7t0d0
disk 6 0/6/1/0.13.12.0.0.0.1 sdisk CLAIMED DEVICE DGC CX700WDR5
/dev/dsk/c7t0d1 /dev/rdsk/c7t0d1
disk 8 0/6/1/0.13.12.0.0.0.2 sdisk CLAIMED DEVICE DGC CX700WDR5
/dev/dsk/c7t0d2 /dev/rdsk/c7t0d2
#> vgdisplay -v vgdata
--- Volume groups ---
VG Name /dev/vgdata
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 40
Open LV 40
Max PV 255
Cur PV 3
Act PV 3
Max PE per PV 51200
VGDA 6
PE Size (Mbytes) 256
Total PE 1117
Alloc PE 958
Free PE 159
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

{..snip..}

--- Physical volumes ---
PV Name /dev/dsk/c6t0d0
PV Name /dev/dsk/c7t0d0 Alternate Link
PV Status available
Total PE 799
Free PE 0
Autoswitch On

PV Name /dev/dsk/c6t0d1
PV Name /dev/dsk/c7t0d1 Alternate Link
PV Status available
Total PE 119
Free PE 0
Autoswitch On

PV Name /dev/dsk/c7t0d2
PV Name /dev/dsk/c6t0d2 Alternate Link
PV Status available
Total PE 199
Free PE 159
Autoswitch On

any advices are greatly appreciated.

Regards,
Cedrick Gaillard
Best regards, Cedrick Gaillard
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: can't found the VGID from a disk

Shalom Cedrick,

Two ideas come to mind.

1) pvcreate needs to be run on the disk, which would require removing it from the volume group.
2) strings /etc/lvmtab is being confused by a set of binary characters that is masking the normal output. perhas mv /etc/lvmtab /etc/lvmtab.old vgscan -a will create a different binary string.

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
James R. Ferguson
Acclaimed Contributor

Re: can't found the VGID from a disk

Hi Cedrick:

I prefer to read a disk directly rather than use 'adb' to sample what the kernel *last* thought. I have seen cases where a replaced disk behaved this way until a reboot occured.

# cat ./getlvmid

#!/usr/bin/sh
typeset RDEV=$1

KIND=`xd -An -j 8192 -N8 -tc ${RDEV} 2> /dev/null | xargs`

if [ "$KIND" = "L V M R E C 0 1" ]; then
INFO=`xd -An -j8200 -N16 -tx ${RDEV}`
PVID=`echo ${INFO} | awk '{print $1 $2}'`
VGID=`echo ${INFO} | awk '{print $3 $4}'`
echo "${RDEV} pvid = ${PVID} vgid = ${VGID}"
fi

# ./getlvmid /dev/dsk/c0t6d0
/dev/dsk/c2t6d0 pvid = 6204a83d3ab304b3 vgid = 6204a83d3ab304b3

Regards!

...JRF...
Robert-Jan Goossens
Honored Contributor
Solution

Re: can't found the VGID from a disk

Hi Cedrick,



Could you post the second line of the output of next commands?

# dd if=/dev/rdsk/c7t0d2 of=/tmp/c7t0d2.disk bs=8k skip=1 count=1
# od -Ax -tx /tmp/c7t0d2.disk

You will need the line starting with 0000010, second and third field combined is the VGID.

Robert-Jan
Rita C Workman
Honored Contributor

Re: can't found the VGID from a disk

Here's a quick way to find the VGID too:

echo "0x2008?4D" | adb /dev/dsk/c-t-d-

It will report 5 columns starting with
2008: <5th column=VGID>

Now as to why you lost it on that disk, ...who knows.

To fix it you might try:

umount all f/s on that vgname
vgchange -a n /dev/vgname
vgcfgrestore -n /dev/vgname /dev/rdsk/
vgchange -a y /dev/vgname

Then run above or your script and see if it's showing the VGID now....

Rgrds,
Rita

mobidyc
Trusted Contributor

Re: can't found the VGID from a disk

Thanks all for your help.

don't know why but now, on this disk i can get the correct informations.

for test, i've added a disk and i've the same problem but with dd.
only dd can give me the correct vgid (thanks Robert-Jan)

the tests on this new disk:
#> strings -t d /etc/lvmtab |grep /dev |grep -v /dev/dsk |sort -k 2 |while read offset vg ; do
xd -An -j$(($offset+1024)) -N8 -tuL /etc/lvmtab |read v1 v2
printf "%-15s %x%x\n" ${vg##*/} ${v1} ${v2}
done
vg00 d7a29712449bc7a3
vgdata d7a29712449ff9e9
vgtest d7a29712471cc9e5

# vgchange -a y vgtest
Volume group "vgtest" has been successfully changed.

#> /tmp/getlvmid /dev/dsk/c6t0d3
/dev/dsk/c6t0d3 pvid = d7a29712471cc8e7 vgid = 00


#> dd if=/dev/rdsk/c6t0d3 of=/tmp/c6t0d3.disk bs=8k skip=1 count=1
1+0 records in
1+0 records out
[ / ]
root@nr0u0264# od -Ax -tx /tmp/c6t0d3.disk
0000000 4c564d52 45433031 d7a29712 471cc8e7
0000010 d7a29712 471cc9e5 21fffff 0
0000020 270 80 126 a
0000030 80 1b8 8 1b0
0000040 2e8 21fe000 400 17
0000050 2000 1bff 21fe400 10ff
0000060 0 0 0 0
*
0000400 44454645 43543031 0 0
0000410 0 0 0 0
*
0002000

#> echo "0x2008?4D" | adb /dev/dsk/c6t0d3
2008: -677210350 1193068775 0 0

i'm pretty sure than in few hours, the informations will be correct with adb.
i'll use dd instead of adb now ;).

Regards,
Cedrick Gaillard
Best regards, Cedrick Gaillard
Jo├лl Techer
Advisor

Re: can't found the VGID from a disk

Hi cedrick

It is Jean-Louis PENNEREE

I'm surprised you 've forgotten some bit of you had learnt few yars ago.

Anyway, you still have "the good reflex"...

Don't forget that there are executables that hp have developed in /usr/contrib/bin directory.

So /usr/contrib/bin/rdvgid /dev/dsk/rcxtxdx command would had been easier to get vgid.

Best regards
Jean-Louis (rlus@ifrance.com)



mobidyc
Trusted Contributor

Re: can't found the VGID from a disk

Hey Jean-Louis how are you.

please can you indicate from what bundle/product comes this tool?
i've never eard from a tool like this.
(remember i was not at your support level, i've never learnt what you learnt)

for the vgid, i was searching from somewhat release undependant, i hope dd is installed on every HP-UX, after verifications i've not rdvgid in /usr/contrib/bin.

production environment is really different from test environment, some tools you have at the support, are not installed or even known here.

thanks for your answer Jean-Louis
Best regards, Cedrick Gaillard
Bill Hassell
Honored Contributor

Re: can't found the VGID from a disk

I have had to do this so many times (read VGID) that I wrote showLVMinfo (attached). It is the code listed above in an easy to read output. You run it by providing a list of CTD (or persistent) names (/dev/rdsk is not needed):

# showLVMinfo c1t6d0

Local CPU ID (hex=0x628b7fc7) 1653309383

/dev/rdsk/c1t6d0:
CPUID=0x628b7fc7 (1653309383), VGID 0x4c4f2e35, PVID 0x4c4f2e34

I *ALWAYS* use vgexport with the -svm options so the VGID (technically, the CPUID+VGID combined) and lvol names are written to the mapfile.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: can't found the VGID from a disk

Oops, here is the showLVMinfo script again, suitable for downloading.


Bill Hassell, sysadmin