Aix: How to assign a specific PVID

Aix: How to assign a specific PVID

1) BACKUP old disk critical data.

# 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

TO RECOVER origional PVID:
# 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 “”. Do
not use spaces or any other characters except for the final c to
keep from issuing a hard return.

# echo "000022243344053311010363c" >/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.

 

There are situations where we need to assign the Particular PVID to disk.

Tthe following steps will let us know those steps to assign the PVID of "abcdef12345678" to hdisk1

The following command to assign new PVID to new disk

root@test:/tmp> chdev -l hdisk1 -a pv=yes

The following command to clear old PVID

root@test:/tmp> chdev -l hdisk1 -a pv=clear
hdisk1 changed

root@test:/tmp> lspv | grep hdisk1
hdisk2          none                                None

root@test:/tmp> perl -e 'print pack("H*","abcdef12345678");' > /tmp/pvid

root@test:/tmp> # cat /tmp/pvid | dd of=/dev/hdisk1 bs=1 seek=128
8+0 records in.
8+0 records out.

root@test:/tmp> rmdev -dl hdisk1
hdisk2 deleted

root@test:/tmp> cfgmgr 

root@test:/tmp> lspv | grep hdisk1
hdisk1          abcdef12345678                    None

 

 

# DISK=hdisk2
# chdev -l $DISK -a pv=clear
hdisk2 changed

# lspv | grep hdisk2
hdisk2          none                                None

# perl -e 'print pack("H*","0123456789abcdef");' &gt; /tmp/pvid

# cat /tmp/pvid | dd of=/dev/$DISK bs=1 seek=128
8+0 records in.
8+0 records out.

# rmdev -dl $DISK
hdisk2 deleted

# cfgmgr

# lspv | grep $DISK
hdisk2          0123456789abcdef                    None

# mkvg -fy testvg hdisk2
testvg

# crfs -v jfs2 -g testvg -m /testfs -a size=20G
File system created successfully.
20970676 kilobytes total disk space.
New File System size is 41943040

# mount /testfs

# lspv $DISK -l
hdisk2:
LV NAME               LPs     PPs     DISTRIBUTION          MOUNT POINT
fslv03                160     160     00..108..52..00..00   /testfs
loglv02               1       1       00..01..00..00..00    N/A

 

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Epoch & Unix Timestamp Conversion Tools
Viewed 43153 times since Fri, Jun 22, 2018
Monitor logfiles and command output on AIX using multitail.
Viewed 1945 times since Thu, Feb 21, 2019
Replacing a failed disk (rootvg)
Viewed 2618 times since Mon, May 21, 2018
Secure Secure Shell
Viewed 9883 times since Fri, Aug 21, 2020
How to check dual path in AIX
Viewed 12499 times since Fri, Jun 8, 2018
Remove disk from volumegroup in AIX
Viewed 5580 times since Tue, Apr 16, 2019
AIX POWERHA/HACMP: Basic commands
Viewed 4771 times since Sat, Jun 2, 2018
Reconfigure RSCT ID to fix DLPAR issues on cloned AIX systems
Viewed 12738 times since Thu, Feb 21, 2019
AIX ODM for MPIO User Guide 09
Viewed 3455 times since Mon, Dec 31, 2018
AIX, Installation, NIM↑ Creating an LPP source and SPOT in NIM
Viewed 13766 times since Fri, Apr 19, 2019