AIX 5L SysAdmin II: (Unit 05) – Disk Management Theory (Part 2 of 3)

LVM Identifiers:
———————–
Goal: Unique worldwide identifiers for:
– Hard disks
– Volume Groups (including logical volumes)

# uname -m
machine Id/Type
00008371 4600

lsvg rootvg
VOLUME GROUP:rootvg VG IDENTIFIER:00008371c98a229d4c000000000000

# lspv
hdisk0 00008371o5969c35 rootvg (32 Bytes long)
machine ID/ date&time configed

# lslv hd4
LOGICAL VOLUME: hd4 VOLUME GROUP: rootvg
LV IDENTIFIER:00008371C98A229D4C000000000000000E.4
(vgid.mINOR nUMBER)

LVM Data on Disk Control Blocks:
————————————————–
Volume Group Descriptor Area (VGDA)
– Most important data structure of LVM
– Global to the volume group (same on each disk)
– One or two copies per disk

Volume Group Status Area (VGSA)
– Tracks the state of mirrored copies
– One or two copies per disk

Logical Volume Control Blocks (LVCB)
– First 512 bytes of each logical volume
– Contains LV attributes (Policies, Number of copies)
– Should not be overwritten by applications using raw devices!

LVM Data in the Operating System:
—————————————————–
Object Data Manager (ODM)
– Physical volumes, volume groups and logical volumes are represented as devices (Customized devices)
– CuDv, CuAt, CuDvDr, CuDep

AIX Files
– /etc/vg/vgVGID – Handle to the VGDA copy in memory
– /dev/hdiskX – Special file for a disk
– /dev/VGname – Special file for administrative access to a VG
– /dev/LVname – Special file for a logical volume
– /etc/filesystems – Used by the mount command to associate LV name, JFS log and mount point

Contents of the VGDA:
———————————-
Header Time Stamp – Updated when VG is changed
Physical Volume List – PVIDs only (no PV names), VGDA count and PV state
Logical Volume List – LVIDs and LV names, Number of copies
Physical Partition Map – Maps LPs to PPs
Trailer Time Stamp – Must contain same value as header time stamp

1 PV – Volume Group – 2 VGDAs
2 PV – Volume Group – 3 VGDAs
The VGDAs must match before bringing the volume group online.

VGDA Example:
————————
# lqueryvg -p hdisk1 -At (Display the VGDA for hdisk1)
Max Lvs: 256
PP Size: 24

Free PPs: 56
LV count 3
PV count 2

Total VGDAs: 3

Max PPs per 1016
Max PVs: 32
Auto Varyon 1 (yes)

Logical: 00008371387yfa8bb0000ce0001390000.1 lv_01 1 (LVIDs)
00008371387yfa8bb0000ce0001390000.2 lv_02 1
00008371387yfa8bb0000ce0001390000.3 lv_03 1

Physical: 00008371b5969c35 2 0 (PVIDs)
00008371b5969c77 1 0
VGDAs

The Logical Volume Control Block (LVCB):
————————————————————–
# getlvcb -AT hd2

AIX LVCB
intrapolicy = c
copies = 1
interpolicy = m
lvid = ……..
lvname = hd2
label = /usr
machine id = …..
number lps = 103
relocatable = y
strict = y
stripe width = 0
stripe size in exponent = 0
type = jfs (jfs, jfslog, paging space, BLV, raw)
upperbound = 32
fs = log=/dev/hd8:mount=automatic:type=bootfs:vol=/usr:free=false
time create = …
time modified = …

Intrapolicy:
c=center
e=outer edge
m=outer middle
im=inner middle
ie=inner edge

How LVM Interacts with ODM and VGDA:
————————————————————-
mkvg
extendvg
mklv
crfs
chfs
rmlv
reducevg

VGDA, LVCB – Change, using low-level commands
VGDA —>>> importvg, exportvg —>>> ODM
ODM /etc/filesystems – Match IDs by name, Update, exportvg

ODM Entries for Physical Volumes (1 of 3):
—————————————————————
# odmget -q “name like hdisk?” CuDv
name – descriptor
hdisk – object
CuDv – object class

CuDv:
name=”hdisk0″
status = 1
chgstatus = 2
ddins = “scdisk”
location = “04-CO-00-2,0”
parent = “scsi0”
connwhere = “2,0”
PdDvLn = “disk/scsi/osdisk”

CuDv:
name = “hdisk1”
status = 1

lsdev -Cc disk (View same information as above)

ODM Entries of Physical Volumes (2 of 3):
————————————————————–
# odmget -q “name=hdisk0 and attribute=pvid” CuAt

CuAt:
name = “hdisk0”
attribute = “pvid”
value = “machine ID, date created
type = “R”

lspv
lspv hdisk0

ODM Entries for Physical Volumes (3 of 3):
—————————————————————
# odmget -q “value3 like hdisk?” CuDvDr

CuDvDr:
resource = “devno”
value1 = “12”
value2 = “1”
value3 = “hdisk0”

CuDvDr:
resource = “devno”
value1 = “12”
value2 = “2”
value3 = “hdisk1”

# ls -l /dev/hdisk*
brw——– 1 root system 12,1 08 Jan 06:56 /dev/hdisk0
brw——– 1 root system 12,2 08 Jan 07:12 /dev/hdisk1

ODM Entries for Volume Groups:
————————————————
# odmget -q “name=rootvg” CuDv

CuDv:
name = “rootvg”
status = 0
chgstatus = 1

# odmget -q “name=rootvg” CuAt
CuAt:
name = “rootvg”
attribute = “vgserial_id”
value = “…”

CuAt:
name = “rootvg”
attribute = “pv”
value = “…”

CuAt:
name = “rootvg”
attribute = “pv”
value = “…”

ODM Entries for Logical Volumes:
————————————————–
# odmget -q “value3=hd2” CuDvDr

CuDvDr:
resource = “devno”
value1 = “10”
value2 = “5”
value3 = “hd2”

# ls -l /dev/hd2

# odmget -q “dependency=hd2” CuDep
CuDep:
name = “rootvg”
dependency = “hd2”

ODM-Related LVM Problems:
——————————————–
VGDA, LVCB – High-Level Commands (ODM)
– Signal Handler
– Lock

What can cause problems?
– kill -9, shutdown, system crash
– Improper use of low-level commands
– Hardware changes without or with wrong software actions
– Terminating commands prematurely

Fixing ODM Problems (1 of 2):
——————————————–
If the ODM problem is not in the rootvg, for example in volume group homevg, do the following:

# varyoffvg homevg (Must umount all filesystem in VG before varyoffvg)
# exportvg homevg (Remove complete volume group from the ODM
# cfgmgr (rediscover the drive)
# importvg -y homevg hdiskX (Import volume group by creating new ODM objects

Fixing ODM Problems (2 of 2):
——————————————–
If the ODM problem is in the rootvg, use script rvgrecover (not provided)
rvgrecover script contents:
PV=hdisk0
VG=rootvg
cp /etc/objrepos/CuAt /etc/objrepos/CuAt.$$
cp /etc/objrepos/CuDep /etc/objrepos/CuDep.$$
cp /etc/objrepos/CuDv /etc/objrepos/CuDv.$$
cp /etc/objrepos/CuDvDr /etc/objrepos/CuDvDr.$$
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
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
odmdelete -q “value1=10” -o CuDvDr
odmdelete -q “value3=$VG” -o CuDvDr
importvg -y $VG $PV # ignore lvaryoffvg errors
varyonvg $VG

Exports rootvg by odmdeletes
Import rootvg by importvg

Lab:
——–
lspv – list the devices on the system
lsvg -p rootvg
odmget -q “name like hdisk? and attribute=pvid” CuAt
/home/workshop/ex5_corrupt_pvid – run script to corrupt the system
lspv – the script removed the information about the disk
lsvg -p rootvg
0516-304: Unable to find device id …..
odmget -q “name like hdisk?” CuDv
odmget -q “name=hdisk0” CuAt | more (No pvid)
lqueryvg -p hdisk0 -At | more (Info in the VGDA is still there)
vi fix.add (To add info back into the ODM)
CuAt:
name = “hdisk0”
attribute = “pvid”
value = “pvid – all 32 bytes”
type = “R”
generic = “D”
rep = “s”
nls_index = “2”
:wq
# odmadd fix.add
lspv – verify the pvid is restored

/home/workshop/ex5_corrupt_odm
lsvg (ok)
lspv (ok)
lsvg -l rootvg (problem in Type)
lslv hd2
0516-306 lslv: Unable to find hd2 in the Device Configuration Database.

odmget -q “name=hd2” CuDv (No information on the logical volume)
odmget -q “name=hd4” CuDv (No information on the logical volume))
odmget -q “name=hd4” CuAt (Some information exists)
CuAt – Customized Attributes are missing

/home/workshop/rvgrecover – run this script to recover the (Copies the VGDA to ODM

lsvg -l rootvg (Everything has been restored)
lslv hd2

Leave a Reply

Your email address will not be published. Required fields are marked *

*