AIX Storage Management: LVM, JFS2 and Physical Volumes Deep Dive

!DOCTYPE html> AIX Storage Mastery: LVM, JFS2, and SAN Management

AIX Storage Mastery: LVM, JFS2, and SAN Management

AIX invented the Logical Volume Manager that Linux later copied. This guide covers everything from physical disk discovery to JFS2 snapshots, SAN multipathing, and recovering a full rootvg.

LVM Stack: PV -> VG -> LV -> FS

LayerAIX TermAnalogyKey Commands
Physical DiskPhysical Volume (PV / hdisk)Raw hard drivelspv, chpv, migratepv
Disk PoolVolume Group (VG)RAID group / poolmkvg, varyonvg, lsvg
PartitionLogical Volume (LV)Partition on poolmklv, chlv, extendlv
FilesystemJFS2 mount pointFormatted partitioncrfs, chfs, mount, df

Physical Volume Management

# List all physical volumes and their VG membership
lspv

# Sample output:
# hdisk0   00c3a1b2d4e5f678   rootvg    active
# hdisk1   00c3a1b2d4e5f679   datavg    active
# hdisk2   00c3a1b2d4e5f680   None

# Show detailed attributes of a disk
lsattr -El hdisk0

# Check hdisk path (multipath) status
lspath -l hdisk1 -F "name status"

# Prepare a new disk for use (clears PVID if needed)
chdev -l hdisk2 -a pv=yes

# Get the PVID of a disk
lspv hdisk2 | grep PVID

Volume Group Operations

# Create a new volume group (default PP size 128MB)
mkvg -y datavg -s 128 hdisk1 hdisk2

# Create with larger PP size for big disks (1GB PP)
mkvg -y bigdatavg -s 1024 hdisk3

# List all VGs
lsvg

# Show VG details (free PPs, PP size, LV count)
lsvg datavg

# List LVs inside a VG
lsvg -l datavg

# List physical volumes in a VG
lsvg -p datavg

# Extend a VG by adding a new disk
extendvg datavg hdisk3

# Remove a disk from VG (migrate data first!)
migratepv hdisk3 hdisk4   # move all PPs from hdisk3 to hdisk4
reducevg datavg hdisk3

# Varyoff and export a VG (for migration)
varyoffvg datavg
exportvg datavg

# Import on another server
importvg -y datavg hdisk1

# Vary on at boot -- set VG to auto-activate
chvg -a y datavg

Logical Volume Operations

# Create a 10GB LV in datavg
mklv -y datalv -t jfs2 datavg 80    # 80 PPs x 128MB = ~10GB

# Create with mirroring (needs 2 disks in VG)
mklv -y mirlv -t jfs2 -c 2 datavg 80

# Show LV details
lslv datalv

# Extend an LV by 5GB (add 40 PPs)
extendlv datalv 40

# Mirror an existing LV
mklvcopy datalv 2    # add a second copy

# Remove a mirror copy
rmlvcopy datalv 1

# Sync stale PPs (after disk replacement)
syncvg -v datavg

# Remove an LV (unmount filesystem first!)
rmlv datalv

JFS2: Create, Resize, Snapshot

# Create a JFS2 filesystem on an LV
crfs -v jfs2 -d datalv -m /data -A yes   # -A yes = auto-mount at boot

# Or create LV + FS in one command
crfs -v jfs2 -g datavg -a size=10G -m /appdata

# Mount it
mount /data

# Check filesystem usage
df -g /data

# Grow filesystem online (no unmount needed!)
chfs -a size=+5G /data      # add 5GB
chfs -a size=20G /data      # set absolute size

# Show filesystem attributes
lsfs -q /data

# JFS2 Snapshot (for online backup)
snapshot -o snapfspath=/snaps/data_snap /data

# Mount snapshot read-only for backup
mount -v jfs2 -o ro /snaps/data_snap /mnt/snap_ro

# Backup from snapshot (application sees live FS, backup reads snap)
tar -cvf /backup/data.tar /mnt/snap_ro

# Remove snapshot when done
snapshot -d /data

JFS2 Compression and Encryption

# Enable inline compression on a new filesystem
crfs -v jfs2 -g datavg -a size=50G -a compress=lz4 -m /compressed

# Encrypted filesystem (AIX EFS)
# First generate a key
echo "mysecretpassphrase" | efsenable -a hdisk1   # enable EFS on disk
crfs -v jfs2 -g datavg -a size=10G -a efs=yes -m /secure

# Check compression ratio
lsfs -q /compressed | grep compress

SAN Disk Discovery and Multipathing

# After SAN admin zones new LUNs to the POWER server:

# Rescan for new disks without reboot
cfgmgr

# List newly discovered disks
lspv | grep -v rootvg | grep -v datavg

# Check multipath status for a disk
lspath -l hdisk5

# Sample output:
# Enabled  hdisk5  fscsi0
# Enabled  hdisk5  fscsi1   <- two paths = good

# Show detailed path info
lspath -l hdisk5 -F "name connection parent state"

# Enable/disable a path
chpath -l hdisk5 -p fscsi0 -s enable
chpath -l hdisk5 -p fscsi0 -s disable

# Change path selection algorithm
chdev -l hdisk5 -a algorithm=round_robin   # default: fail_over
# Options: fail_over, round_robin, shortest_queue, rotational

# Check reserve policy (important for cluster shared disks)
lsattr -El hdisk5 | grep reserve
chdev -l hdisk5 -a reserve_policy=no_reserve   # for HACMP shared disks

PCM (Path Control Module)

# Show PCM for each disk
lsdev -Cc disk | grep hdisk | while read dev rest; do
  echo -n "$dev: "
  lsattr -El $dev | grep "PCM path" 2>/dev/null || echo "N/A"
done

# SDDPCM (Subsystem Device Driver PCM) -- for IBM DS/Storwize
lsdev -Cc disk | grep sdd      # SDD managed disks show as hdiskpower

mksysb and savevg Backup

# Full system backup (bootable) to file
mksysb -i /backups/$(hostname)_$(date +%Y%m%d).mksysb

# Backup to tape
mksysb -i /dev/rmt0

# Backup a data VG
savevg -f /backups/datavg_$(date +%Y%m%d).savevg datavg

# Verify a mksysb image
restorevgfiles -qf /backups/server1.mksysb ./     # list contents

# Restore a VG from savevg backup
restvg -f /backups/datavg_20240101.savevg

# alt_disk_copy -- hot standby rootvg (no downtime)
alt_disk_copy -d hdisk2      # copies rootvg to hdisk2
# If hdisk0 fails: boot from hdisk2, it has complete OS copy

Troubleshooting

Disk Full on rootvg

# Find what's consuming space
du -sg /* 2>/dev/null | sort -rn | head -10

# Find large files
find / -xdev -size +100M -ls 2>/dev/null | sort -k7 -rn | head -20

# Quick wins: clean error log, install images
errclear 0
rm -rf /usr/sys/inst.images/*
find /var/adm/ras -name "*.log" -mtime +30 -delete

# Grow /tmp or /var online
chfs -a size=+2G /tmp
chfs -a size=+2G /var

Stale Physical Partitions

# Check for stale PPs (after disk failure/replacement)
lsvg -l datavg | grep stale

# Sync all stale PPs
syncvg -v datavg

# If sync fails (bad disk), replace the disk:
# 1. Remove failed disk from VG
replacepv hdisk_old hdisk_new   # or:
migratepv hdisk_old hdisk_new
reducevg datavg hdisk_old

VG Fails to Varyon

# Check why varyonvg failed
varyonvg -n datavg   # -n = no-quorum override (use carefully)

# Check VGDA (volume group descriptor area) on all disks
lqueryvg -Atp hdisk1
lqueryvg -Atp hdisk2

# Force varyon if majority of disks available
varyonvg -f datavg
[YES] Best practice: Always run syncvg -v rootvg after any disk replacement. Check lspv weekly -- any disk showing stale needs immediate attention before it escalates to data loss.

Key Takeaways: AIX LVM is deeper and more capable than Linux LVM. Understand PP sizes -- they affect granularity of space allocation. Always mirror rootvg with alt_disk_copy. Use JFS2 snapshots for zero-downtime backups. For SAN disks, validate multipath status weekly with lspath.

AIXLVMJFS2SANStorageIBM POWERmksysb

Post a Comment

0 Comments