Skip to main content

AIX LVM

PV
# Add a disk hdisk3 to a PV
## NOTE: 新 disk 要加入 PV 成功後,執行 lspv 才會有 pv-id
cfgmgr
chdev -l hdisk3 -a pv=yes
lspv

# Remove a PV from a disk hdisk3
## If done, the pv-id appears 'none' 
chdev -l hdisk3 -a pv=clear
lspv

# 檢視 PV 使用/剩餘空間
lspv <PV-NAME>

# 檢視 PV 被使用的狀況
lspv -M hdisk0

# 檢視 PV 包含的 LVs
lspv -l hdisk0

# Check the hdisk VendorId/size
lsmpio -q
VG
# Create VG with 128M(PP size)
mkvg -y <vg-name> -s 128 hdisk1 hidisk2

# Add PVs hdisk3, hdisk4 to specific VG 
extendvg <vg-name> hdisk3 hdisk4

# Remove a VG with PVs hdisk3, hdisk4
reducevg <vg-name> hdisk3 hdisk4

# List commands
lsvg <VG-NAME>     # Check the VG
lsvg -l <VG-NAME>  # Check the LVs in the VG
lsvg -p <VG-NAME>  # Check the PVs in the VG
LV
# Create LV with 5G
## mklv -y <lv-name> -t jfs2 <vg-name> [LP-number|GB-size]
/usr/sbin/mklv -y'siview_lv' -tjfs2 smapvg 80
/usr/sbin/mklv -y'siview_lv' -tjfs2 smapvg 10G

# Remove a LV
rmlv <lv-name>

# List the PVs for specified LV
lslv -l <LV-NAME>

LV Mirror

# Add a copy of LV hd4 into specified PV hdisk1
## mklvcopy <LV-NAME> <NUMBER-of-COPY(1|2)> <PV-NAME>
mklvcopy hd4 2 hdisk1

syncvg -v rootvg

# Verify the state
## Check STALE PVs: 0, STALE PPs:0
lsvg rootvg

## Check the LV STATE: open/syncd
lsvg -l rootvg

# Remove a copy of LV from specified PV
rmlvcopy hd4 1 hdisk1
Filesystem
# Create a filesystem with /data
## -A: Whether the filesystem is mounted at each system restart.
## crfs -v jfs2 -A yes -d <lv-name> -m <mount-point> -a logname=INLINE
/usr/sbin/crfs -v 'jfs2' -A'yes' -d'siview_lv' -m'/home/siview' -a logname=INLINE
mount /home/siview

# Extend the size of 1024MB for specified filesystem
chfs -a size=+1024M /home
## Alternatively, resizing to specified number
chfs -a size=2048M /home

# Remove a filesystem
## Check if the mount-point has been closed/syncd
lslv -l <vg-name>
rmfs <mount-point>