ITEM: H7945L

How large is my rootvg VGDA?


        I have 8 disks in my rootvg.  One is going bad and I want to
add another 1 GB disk and then do a migratepv to move the data from 
the bad disk to the new one.  Any down time is very difficult on my
company so I don't want to run into complications.  In the past I have
had trouble adding a disk to rootvg due to the VGDA size not being 
large enough.  Is there any way I can see if my VGDA will allow me
to add this next disk before I actually try it?  If it depends on how 
large rootvg was when I first created it, how can I tell how many
disks I used when I did my last reinstall?

Response:

        You can tell by looking in the /etc/vg directory.  Do an
ls -l and look at the size of the file that is named after the rootvg
VGid number.  It will be something like vg00001165474E7F50.  You can
get the rootvg VGid number by typing getlvodm -v rootvg.  The size
of this file is proportional to the size of the VGDA on the disks.

        By looking at the vg file size we can determine how many
disks were in rootvg when the volume group was created at the time of
your last reinstall.  A size like 62188 or 65536 bytes means rootvg was 
created with only one disk.  A size like 94956 or 98304 means 2 disks,
127724 or 131072 means 3 disks, etc.  Here is a description of how the 
size of the VGDA is calculated:  

                SIZE of the VGDA of AIX Volume Groups

   At installation, when rootvg is create, a MAXPV variable is calculated.
   This number is the number of physical disks DEFINED for rootvg.  This 
   number cannot be changed.  It's used is to define a particular size 
   for the Volume Group Descriptor Area (VGDA) so that the VGDA will fit 
   into memory when booting.  When you boot your machine, the VGDA is 
   read into memory from the physical disk.  If the VGDA takes up all 
   your RAM, the machine will not be able to continue to IPL.  Thus a 
   variable is set to limit the amount of space that the VGDA uses during
   IPL.  The rootvg VGDA is a static area that gets filled as you add 
   physical and logical volumes.  This area is usually calculated to be 
   large enough to expand rootvg some, however, in some cases, when many 
   drives are added, they exceed the VGDA space.  Thus the entries cannot
   be written to the VGDA giving you the "linstallpv" error.

   You can add more disks to rootvg, but you will need to backup your 
   system and reinstall AIX with ALL the disks installed into the rootvg.
   You can then restore your data.  The necessity of re-installation is 
   to re-calculate the static rootvg VGDA area to contain enough entries 
   for the physical and logical volumes defined on rootvg.

The default assumptions used by mkvg are:

  PPSIZE = 4M
  PPSPPV = 1016
  MAXPVS = 32    (when creating a user volume group)
  MAXLVS = 256
  LVSBLK = 16    (for logical volume map)
  PPSBLK = 16    (for physical partion map)
  NAMESBLK = 8   (for name map)

From these numbers, it looks like, by default, the VGDA is created with 
enough space for 32 4GB drives (actually, just less than 4GB -> 1016*4M).  
Unfortunately, for rootvg this space is limited by the MAXPVS variable 
which is set at installation to the number of drives that are selected 
for rootvg.

Here is a script that will show you the size of the VGDA calculated by 
mkvg.  All default (max) values are used except for the Maximum number 
of PVs which is determined by an optional argument to the script.  If no 
number is passed to the script, 32 is used.  

To see how large the VGDA is for a particular volume group, look at the
size of the file stored in /etc/vg.  These files are stored by the VGID 
number.  This file contains all of the VGDA information plus some 
additions descriptors such as the VGname and PVnames that are associated 
with the volume group.  The size of the file starts out as VGDAsize + 
3820 bytes.  If enough changes are made to the volume group this file 
will grow to be VGDAsize + 7168 bytes.

Here is the script that will calculate these numbers:

\#!/bin/ksh 
\# vgdasize: This script uses the calculations from the mkvg script
\# in order to output the size of the VGDA, given the number of
\# physical volumes in the volume group.  
\#
\# parameters: DVAL - the Maximum number of PVs; default 32.
\#
\# FYI. mkvg uses the following flags:
\# 
\# MFLAG='-m';  \#maximum size of PV
\# NFLAG='-n';  \#vg not automatically varied on at IPL
\# IFLAG='-i';  \#pvnames read from standard in
\# FFLAG='-f';  \#force flag
\# SFLAG='-s';  \#ppsize
\# YFLAG='-y';  \#vgname
\# DFLAG='-d';  \# descriptor size
\# VFLAG='-V';  \# major number
\#

if [ $\# = 1 ]
then
  DVAL=$1
else
  DVAL=32
fi

PPSPPV=1016   \# | PPSPPV=`expr $MVAL / $SVAL`
MAXLVS=256
LVSBLK=16; PPSBLK=16; NAMESBLK=8
LVLIST=`expr $MAXLVS + $LVSBLK - 1`             \# LV entries
PPLIST=`expr $PPSPPV + 1 + $PPSBLK - 1` \# PP entries
NAMELIST=`expr $MAXLVS + $NAMESBLK - 1` \# Name entries
VGDASIZE=`expr $LVLIST / $LVSBLK + $PPLIST / $PPSBLK \\* $DVAL + $NAMELIST \\
  / $NAMESBLK + 2`
ETCVG1=`expr $VGDASIZE \\* 512 + 3820`
ETCVG2=`expr $VGDASIZE \\* 512 + 7168`

echo ""
echo "DVAL = $DVAL"
echo "PPSPPV = 1016; MAXLVS = 256; LVSBLK = 16; PPSBLK = 16; NAMESBLK = 8"
echo "LVLIST = \\$MAXLVS + \\$LVSBLK - 1 = $MAXLVS + $LVSBLK - 1 = $LVLIST"
echo -n "PPLIST = \\$PPSPPV + 1 + \\$PPSBLK - 1 "
echo "= $PPSPPV + 1 + $PPSBLK - 1 = $PPLIST"
echo -n "NAMELIST = \\$MAXLVS + \\$NAMESBLK - 1 = $MAXLVS + $NAMESBLK - 1 "
echo "= $NAMELIST"
echo ""
echo -n "VGDASIZE = \\$LVLIST/\\$LVSBLK + \\$PPLIST/\\$PPSBLK * \\$DVAL + "
echo "\\$NAMELIST/\\$NAMESBLK + 2"
echo -n "VGDASIZE = $LVLIST/$LVSBLK + $PPLIST/$PPSBLK * $DVAL + "
echo "$NAMELIST/$NAMESBLK + 2"
echo "VGDASIZE = $VGDASIZE 512-byte blocks or `expr $VGDASIZE \\* 512` bytes" 
echo ""
echo "The corresponding /etc/vg file size should be: $ETCVG1 or $ETCVG2 bytes"


Support Line: How large is my rootvg VGDA? ITEM: H7945L
Dated: April 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:46
Comments or suggestions? Contact us