LVM – Logical Volume Manager
Explain terms such as volume group, physical or logical volume
Solve ODM-related LVM problems
Use the properties of LVM objects to optimize performance and/or availability
LVMs Basic Concepts
Rose within the AIX kernel:
– Resides above the physical disk device drivers.
– Looks like a device driver to higher levels (filesystems, applications)
– Maps higher level I/O requests to physical I/O requests.
– May change this mapping dynamically
– Can be created, extended, moved and deleted at runtime
– May span several disks
May be mirrored and/or striped
PV – Physical Volumes (hdisk#, PV ID 32bytes)
PP – Physical Partitions (limit of 1016 partitions per physical volume – from 1MG to 1024MG in size)
VG – Volume Group
Note: There is a limit of 1016 partitions per physical volume. Partition size can range between 1MG to 1024MG.
LV – Logical Volume
LP – Logical Partitions
cfgmgr – runs and identifies new physical disk drives
extendvg – add the physical volume to a volume group (devided into physical partitions the same size of the partitions on the existing disk in the volume group)
Note: If you try to add a larger disk to a volume group that has smaller disks already you won’t be able to use all of the larger disk. You will reach the 1016 partition limit before you use up the disk space. Must increase the partition size on all of the disks in the (LV)Logical Volume.
Version 4.3.2 allows multiple sets of partition sizes of 1016.
mkvg -t 2 (every disk gets 2032 partitions)
chvg -t 2
Normal VG: Max 32 PVs, -t 2 = 16 PVs
Big VG: Max 128 PVs, -B 2 = 64 PVs
Giant VG: Max 1024 PVs, -G 2 = 512 PVs
Note: Can’t change these once they are set.
LVM – LPs point to PPs
Mirrored LV –> Two LPs point to PPs on two separted PVs in the same VG.
Note: Can turn mirroring on and off.
Striped Logical Volume –> Logical Partitons –> Physical Partitions
Data is striped accross multiple PVs.
Note: Once striping is turned on, it is always on – Can’t turn it off
PV, VG and LV Identifiers (1 of 2)
Goal is to have unique IDs worldwide for:
– Hard disks
– Volume groups (including logical volumes)
Assign large (32 or 16 byte) numbers
– To PVs at the time of first use
– To VGs and LVs at creation time
Numbers consist of:
– CPU ID of creating host
Representation: bitstring or hexadecimal number
PV, VG and LV Identifiers (2 of 2)
# uname -m (displays the machine id)
PVIDs and cfgmgr
cfgmgr runs at boot time
The actual hardware configuration is compared to the ODM.
When is a device considered to be the same as before?
For non-disk SCSI devices:
– Class, subclass and type must be same
– The location code (adapter slot, SCSI ID) may not have changed
For disk devices:
– Class, subclass and type must be same
– The PVID must be the same
– The location code may change and the disk keeps its name
ODM – Object Data Manager
PdDv – Predefined Devices
PVIDs and cfgmgr in HACMP Environments
– A machine connected to a shared disk is being rebotted
– A shared volume group is varied on by another system
– Disk reservation prevents cfgmgr from reading the PVIDs.
Result: Ghost Disks
– Look like brand new disks (lspv displays hdiskG None none).
– Same location code as original disks
– Original disks are in DEFINED state.
Corrective Action: Non. Leave this to HACMP
– get_disk_vg_fs invokes the cl_disk_available utility
– Removes ghost disks and makes the original disks AVAILABLE again.
– Manual repair attempts (for example, diag -a) may delete the original disk or even interrupt I/O operations of the using node.
LVM Data Structures on VG Member Disks
Volume Group Descriptor Area (VGDA)
– Main administrative data structure of LVM
– Global to the VG (that is, the same on each disk)
– One or two copies per disk (multiples must match)
Quorum Checking – must have 50% or more of the VGDA to match to keep the VG varied on. (Probably a disk problem when varied off for this reason)
1 Disk – two VGDAs
2 Disks – Two VGDAs on one disk, One VGDA on the other
3 or more Disks – One VGDA on each disk
Volume Group Status Area (VGSA)
– Needed to track the state of mirror copies
– Per-disk structure, but twice on each disk
Logical Volume Control Blocks (LVCBs)
– First 512 bytes of each logical volume
– Contains LV attributes
– May not be overwritten by appliations using raw devices
– Have been moved into the VGDA with “Big VGs”.
LVM Data in the Operating System
Object Data Manager (ODM):
– PVs, VGs and LVs are represented as devices
– class files in $ODMDIR contain attribute information
– /etc/vg/vgVGID – handle for the kernel’s map file image of the VGDA
– /dev/hdiskX – special file representing a PV
– /dev/VGname – special file for VG admin.commands
– /dev/LVname – is a special file representing a LV
– /etc/filesystems – used by “mount” and other commands to associate mount point and LV.
Contents of the VGDA
Header Time Stamp
– Update when VG is changed
Physical Volume LIst
– PVIDs only (no PV names)
-VGDA count and PV state
Logical Volume List
– LVIDs and LV names
– Mirror copy count
Physical Partition Map
– Most important data structure
– Maps LPs to PPs
Trailer Time Stamp
– Must contain same value as header time stamp for VGDA to be intact
A Look into the VGDA (Example)
lqueryvg -p hdisk0 -At (A = All information, t = show the title of each line)
PP Size: 24 (means 2 to the 4th power = 16 MB)
PP Size: 27 (means 2 to the 7th power = 128 MB)
PP Size: 30 (2 to the 10th power = 1024 MB)
mkvg [ -d MaxPVs | -B | -G ] [ -t Factor ] [ -m Max PVsz ] [ -s PPsz ] [-f ] [ -n ] [ -c ] [ -V MajorNumber ] [ -y VGname ] hdisk X …
– The system checks if the specified disks are not part of a VG already.
– The first test is based on local ODM data only.
– If a VGDA is found on one of the disks, the user is prompted to confirm the overwrite unless -f has been specified.
– (-B and -G) create a Big (or Giant) VGDA: 128 (or 1024) PVs per VG
– (-t) >= AIX 4.3.1, -d and -m also affect the VG’s scalability
– (-n) disables auto-varyon at boot time
– (-c) creates the VG concurrent capable (for OPS with HACMP only).
– If a major number is not specified, the system will pick an unallocated one.
– If a name is not specified, a name like vg00, vg01 … is generated.
– (-V#) The max number of disk in the VG