IBM Support

Rebuilding a Volume Group's Customized Device Database

Question & Answer


Question

Rebuilding a Volume Group's Customized Device Database

Answer

Run the script in this document when the ODM (Object Data Manager) entries for
the root volume group are corrupted.


For non-rootvg volume groups, all that should be required is to varyoff
the volume group, export the volume group, and re-import it. If the volume group cannot be varied off for some reason, the script may be modified for volume
groups other than rootvg. (See the section "About the script" in this document.)

Problem determination

When the ODM entries for a volume group are corrupted, you may notice one of
the following symptoms:

* The lsvg, lslv or lspv commands fail.
* You cannot change the size of file systems.
* The system cannot find volume groups or device IDs.
* The output of the following command contains question marks (?s) in some fields, or some fields are blank:
# lsvg -l vgname

Before using the script

Before using the following script, you may wish to save the current version of
your /etc/objrepos/Cu* files, in case you want to go back to that version at some time. This is optional. Enter:

   # mkdir /etc/objrepos/Cu.bak
  # cp /etc/objrepos/Cu* /etc/objrepos/Cu.bak


About the script

This script contains only a few provisions for handling error conditions
because it is designed to minimize typing mistakes.

The PV (physical volume) and VG (volume group) variables on the first two
lines of the script are defaulted for the root volume group (rootvg). The
PV is set to /dev/ipldevice, which is a synonym for one of the
physical volumes that is a member of the rootvg volume group.

To run this script for a volume group other than the rootvg, you
must change the VG variable to match the volume group you wish to fix, and
change the PV variable to match any one of the physical volumes
(/dev/hdisk#) that is a member of that volume group. To
determine to which VG a PV belongs, enter the command:

# lsvg `lqueryvg -vp hdisk#` | grep GROUP

Please note that grave accent (backtick) characters are used in the preceding
command.

It is not necessary to reboot after running this script.

If this script is being used to clean up a rootvg AND the rootvg is
mirrored, you must run the bosboot command to the disks that make up the bootable
rootvg. There is no need to reboot after the bosboot.

This script calls the synclvodm command, which will change the
permissions on all logical volume device files to 660 and their ownership to
root:system. This may cause problems with database applications that use raw
logical volumes whose device files have had their ownership or permissions
changed. Running this script may thus require you to shut down applications
that operate in this manner, and change the permissions and ownership on those
files when finished.


The Script


NOTES:

Run the following script while in Normal mode and logged in as root.

Depending on how you are viewing this document, some characters in the
following code may appear incorrectly. If the characters in the following list
do not match their descriptions, be sure to change them in the code.

Page headers and footers may appear in the following code.
They should be removed before the code is used. Also, revision bars (vertical
bars in the left margin which denote changes in the document) may appear to the
left of the code and should be removed before the code is used.

The script below assumes you are rebuilding the ODM definitions for the
rootvg, which cannot be exported and then re-imported on a live system. For
most other volume groups, an export/import is the best way to clean up ODM
problems. If you need to rebuild ODM definitions for volume groups other than
the rootvg, substitute appropriate values for PV and VG.

#!/usr/bin/ksh


PV=`lslv -l hd5 | grep hdisk | head -1 | awk '{print $1}'`
VG=rootvg
lqueryvg -Lp $PV | awk '{ print $2 }' | while read LVname; do
odmdelete -q "name = $LVname" -o CuAt
odmdelete -q "name = $LVname" -o CuDv
odmdelete -q "value3 = $LVname" -o CuDvDr
odmdelete -q "dependency = $LVname" -o CuDep
done
odmdelete -q "name = $VG" -o CuAt
odmdelete -q "parent = $VG" -o CuDv
odmdelete -q "name = $VG" -o CuDv
odmdelete -q "name = $VG" -o CuDep
odmdelete -q "dependency = $VG" -o CuDep
if [ "$VG" = rootvg ]
then
odmdelete -q "value1 = 10" -o CuDvDr
else
odmdelete -q "value1 = $VG" -o CuDvDr
fi
odmdelete -q "value3 = $VG" -o CuDvDr
importvg -y $VG $PV # ignore lvaryoffvg errors
varyonvg $VG
synclvodm -Pv $VG # use -P only if running AIX V4.2.1 or later
savebase


Related documentation

For more in-depth coverage of this subject, the following
IBM publications are recommended:

AIX Documentation: System Management Guide: Operating System and Devices
AIX Documentation: Commands Reference

[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"File management","Platform":[{"code":"PF002","label":"AIX"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Historical Number

isg1pTechnote0216

Document Information

Modified date:
17 June 2018

UID

isg3T1000119