Pages

AIX LVM (Logical Volume Manager)

Physical Volumes (PVs):
A Physical Volume (PV) is any AIX-recognized disk, like hdisk0. It's the base layer of LVM, divided into equal Physical Partitions (PPs), each with a fixed size per VG. Every PV has a unique PVID to prevent mix-ups if device names change after a reboot.

Commands & Examples
# List all PVs
lspv

# Show details of a specific PV
lspv hdisk0

# Assign a PVID to a disk
chdev -l hdisk2 -a pv=yes

# Clear a PVID
chdev -l hdisk2 -a pv=clear

Example lspv output:
hdisk0          00c1a2b3c4d5e678    rootvg      active
hdisk1          00d9e2f3a4b5c678    datavg      active
hdisk2          none                None
(none) indicates the disk has no PVID yet.

Volume Groups (VGs):
A Volume Group (VG) pools one or more PVs into a single logical storage unit. Logical Volumes (LVs) are carved from this pool.

VGDA (Volume Group Descriptor Area): Metadata stored on each PV, containing VG name, PV/LV mapping, and quorum info. Redundant copies ensure recoverability.

Quorum: Ensures that >50% of PVs are active before a VG is used. Prevents corruption. Can be disabled for mirrored or test VGs:

# chvg -Qn rootvg

VG Types Comparison
FeatureNormal VGBig VGScalable VG
Max PVs321281024–4096
Max PPs/PV1016130,0482,097,152
Max PV Size~128 GB1 TB1 PB
Max VG Size128 GB8 TB4 PB
PP Size Range1–256 MB1–256 MB1 MB–1 GB
QuorumYesYesOptional

VG Commands

List all VGs
# lsvg

Show VG details
# lsvg rootvg

Show PVs in VG
# lsvg -p datavg

Show LVs in VG
# lsvg -l datavg

Create VG (Normal/Big/Scalable)
# mkvg -y datavg hdisk1
# mkvg -B -y bigvg hdisk2
# mkvg -S -y scalablevg hdisk3

Add/Remove PV
# extendvg datavg hdisk2
# reducevg datavg hdisk2

Import/Export VG
# importvg -y datavg hdisk1
# exportvg datavg

Physical & Logical Partitions:
Physical Partition (PP): Smallest allocatable unit on a PV. Size fixed per VG (e.g., 4–512 MB).
lsvg datavg | grep "PP SIZE"

Output: 32 megabyte(s)
Logical Partition (LP): Virtual allocation in an LV. 1 LP maps to 1+ PPs.
Example: 100 LPs × 32 MB PP = 3.2 GB LV (6.4 GB mirrored)
Check PV PPs:
# lspv hdisk0
TOTAL PPs: 6399 (204 GB)

Logical Volumes (LVs):
Logical Volumes (LVs) are carved from VGs, acting as virtual disks. They can be used for:
  • File systems: JFS2, JFS
  • Raw volumes: Databases, paging
  • Boot/root volumes
  • Mirrored LVs
Commands & Examples

Create LV
# mklv -y lvdata datavg 100   # 100 LPs

List LVs in VG
# lsvg -l datavg

Show LV details and mapping
# lslv lvdata
# lslv -m lvdata

Extend LV
# extendlv lvdata 50  # Add 50 LPs

Remove LV
# rmlv lvdata

Create filesystem on LV
# crfs -v jfs2 -d lvdata -m /data

LV Mapping Example
LP   PP    PV
1    100   hdisk1
2    101   hdisk2
...


Tips & Best Practices
  • Always check quorum before performing VG operations.
  • Keep VGDA redundancy intact for recovery.
  • Start small and scale VGs as storage needs grow.
  • Use lsvg -l, lslv -m, and lspv to visualize mappings before critical changes.
  • Mirror critical LVs for production systems using mklvcopy.
Assign PVs:
# chdev -l hdisk2 -a pv=yes
# chdev -l hdisk3 -a pv=yes

Create a VG:
# mkvg -S -y appvg hdisk2 hdisk3

Create a mirrored LV:
# mklvcopy -m 2 -y applv appvg 200

Create filesystem and mount:
# crfs -v jfs2 -d applv -m /appdata
# mount /appdata

No comments:

Post a Comment