Saturday, September 11, 2010

Assiging original PVID to hdisk in AIX

Problem:
--------


I am using AIX 5.3L with EMC Symmetrix storage, establishing BCV's and then
splitting them and mounting them to the same host. I can mount the BCV's to
the same host using the 'recreatevg' command, but the problem I'm having is
when I'm restoring a BCV back to the standard. When the BCV is restored and
I do an 'lsvg vg1' where vg1's original PV was hdiskpower33 (the standard) it
is now hdiskpower35 (the BCV). I do not want this to happen and suspect the
problem is that the BCV's PVID was changed during the recreatevg. I want to
assign the original PVID to the BCV so that it will not remove hdiskpower33
from vg1. If I do 'rmdev -dl hdiskpower35' and then do 'lsvg -p vg1' I get
an error stating that the PVID was not found, and hdiskpower33 is not listed
as being a member of the vg1 volume group. I've tried doing:

chdev -l hdiskpower35 -a pv={original pvid}

but am told it is an illegal parameter. Is there another way to do this?


Solution:
---------

Use at your own risk:

1) BACKUP old disk critical information

# dd if=/dev/hdisk9 of=/tmp/hdisk9.save bs=4k count=1

If something were to go wrong and the head information got damaged
use the following to RECOVER the origional PVID and head information

RECOVERY
# dd if=/tmp/hdisk9.save of=/dev/hdisk9 bs=4k count=1

2) Find the origional PVID. This might be seen with lspv importvg, or
varyonvg. Our example origional PVID is "0012a3e42bc908f3"

# lqueryvg -Atp /dev/hdisk9
...
Physical: 0012a3e42bc908f3 2 0
00ffffffc9cc5f99 1 0
...

3) Verify that the disk sees an invalid PVID. The first 2 data fields
of offset 80 contain the PVID.

# lquerypv -h /dev/hdisk9 80 10
00000080 00001155 583CD4B0 00000000 00000000 ...UX<.......... ^^^^^^PVID^^^^^^^ 4) Translate the ORIGIONAL PVID into the octal version. Take every 2 digits of the hex PVID and translate it to octal. This can be done by hand, calculator, script, or web page. 00012a3e42bc908f3 -> 00 12 a3 e4 2b c9 08 f3
Octal version -> 000 022 243 344 053 311 010 363

5) Write the binary version of the PVID to a file by using the octal
values. Each octal char is lead with a backslash-Zero "\0". Do
not use spaces or any other characters except for the final \c to
keep from issuing a hard return.

# echo "\0000\0022\0243\0344\0053\0311\0010\0363\c" >/tmp/oldpvid

6) Verify that the binary pvid was written correctly. The origional
hex PVID should be seen AND the final address should be "0000010"
If EITHER of these is incorrect, try again, make sure there are no
spaces in the echo and the echo ends with a "\c".

# od -x /tmp/oldpvid
0000000 0012 a3e4 2bc9 08f3
0000010

7) Restore the PVID to the disk. You sould see 8 records in and out.
If there are more or less, restore the origional 4K block by using
the recovery method in step 1.

# cat /tmp/oldpvid dd of=/dev/hdisk9 bs=1 seek=128
8+0 records in.
8+0 records out.

8) Verify that the PVID was written correctly

#lquerypv -h /dev/hdisk9 80 10
00000080 0012A3E4 2BC908F3 00000000 00000000 ....+...........

9) Reconfigure the disk definitions on all systems attaching to that disk.
The ODM information for that drive will NOT be updated until the
disk is removed and reconfigured. Until that reconfigure commands
like `lspv` will still be incorrect.

No comments: