Aix LVM Howto
id : kp49fyhs91
category : computer
blog : unixlinux
created : 03/23/10 - 18:12:32

Add a VG
mkvg -s <PP_size_in_M> -f -y <vg_name> <device_x> <device_y> ...

Add a PV to a VG
  • On AIX disks are PV you just need to add a disk to have a new PV (this one can be added to a VG)
  • You can check your PV with this command :
# lsdev -Cc <device>

  • Discover new disk with cfgmgr
# lspv | sort > /tmp/pv_before
# cfgmgr
# lspv | sort > /tmp/pv_after

  • Find your new pv by making a diff between those two files
# diff /tmp/pv_before /tmp/pv_after

  • Set a PV id on your new disk
# chdev -l <new_device> -a pv=yes

  • To have a look on your device attribute your can use lsattr command
# lsattr -El <device>

  • To know PV size use bootinfo command
# bootinfo -s <device>

  • You now just need to extend your vg with extendvg command
# extendvg <vg_name> <new_device>

hdiskpower case
  • If you have your lun number and want to verify your disk is this new disk
# powermt display dev=hdiskpowerxxx | grep Logical
Logical device ID=1B92

Add an LV
  • Check your PPs size to know how many PPs you need
    • Generally PPs size are :
      • 64 Mb
      • 128 Mb

  • You can check an LV PPs size with lsvg command
# lsvg <a_vg>
VOLUME GROUP:       avg                      VG IDENTIFIER:  00c8a5f000004c000000011c5674c609
VG STATE:           active                   PP SIZE:        128 megabyte(s)
VG PERMISSION:      read/write               TOTAL PPs:      816 (104448 megabytes)
MAX LVs:            512                      FREE PPs:       244 (31232 megabytes)
LVs:                25                       USED PPs:       572 (73216 megabytes)
OPEN LVs:           24                       QUORUM:         2 (Enabled)
TOTAL PVs:          3                        VG DESCRIPTORS: 3
STALE PVs:          0                        STALE PPs:      0
ACTIVE PVs:         3                        AUTO ON:        yes
MAX PPs per VG:     130048
MAX PPs per PV:     1016                     MAX PVs:        128
LTG size (Dynamic): 256 kilobyte(s)          AUTO SYNC:      no
HOT SPARE:          no                       BB POLICY:      relocatable

  • For example you need to add an 25G LV on a VG with 128 PPs
# bc

  • Your LV must have 200 PPs
  • Be carefull to have enough free PPs on your LV

  • You can now create your LV
# mklv -t jfs2 -y <lv_name> <vg_name> 200

  • You can check this one was successfully create :
# lsvg -l <vg_name> | grep <lv_name>
lvname           jfs2       200      200      1    closed/syncd

  • Since you have created your LV you nedd to create a filesystem on it
# smitty fs

  • Follow options on menu :
    • Add / Change / Show / Delete File Systems
    • Enhanced Journaled File Systems
    • Add an Enhanced Journaled File System
    • Choose your LV and follow the instructions


# crfs -d <lv_name> -v <fs_type> -m <mountpoint> -A yes (no if cluster) ('-a bf=true' if jfs) ('-a log=INLINE' if jfs2) [-a options=cio] [-a agblksize='512']

  • If you forget to add cio option you can do this :
# chfs -a options=cio <mountpoint>
# umount <mountpoint>
# mount <mountpoint>

  • If you forget to add agblksize you can do this :
# chfs -a agblksize='512' <mountpoint>

# umount <mountpoint>
# mount <mountpoint>

  • To check if filesystem is mounted with an option, have a look in /etc/filesystems
#cat /etc/filesystems

or use lsfs command
# lsfs -qc

  • Finally mount your just created LV
# mount <mountpoint>

  • If you want to have particular rights on this mountpoint, chown after mounting
# chown <user>.<group> <mountpoint>

  • You can check your file system was successfully created :
# lsvg -l <vg_name> | grep <lv_name>
an_lv           jfs2       200      200      1    open/syncd    /a/mount/point

Create an additional sysdump
  • If you want to create an additionnal sysdum lv, use this command :
mklv -t sysdump -y <lv_name> <vg_name> <number_of_pp>

  • And use it as secondary sysdump device :
# sysdump -s /dev/<lv_name> -P

Create a raw device
  • If you want to create a raw device (for oracle per example), use this command :
# mklv -t raw -y <raw_device_name> <vg_name> <number_of_pp>

Extend a raw device
  • If you want to extend a raw device, just use extendlv command :
# extendlv <raw_device_name> <number_of_pp>

Extend an LV
  • First of all you need to find on which VG is this LV
# lslv <lv_name> | grep 'VOLUME GROUP'

  • Check if their is free space on this VG
# lsvg <vg_name>

  • Look at PP SIZE and FREE PP to see if there is free space
  • If their is no free space add a new disk

  • Scan for new disk after after his addition
# cfgmrg

  • You can now extend your vg with vgextend command
# vgextend <vg_name> <pv_name>

  • And extend your LV
# chfs -a size=+XG|M <mountpoint>

  • This command resize LV and extend your filesystem at one time
  • + : extend
  • - : reduce
  • G : Giga
  • M : Mega

  • If max LP is reached, change max LP of LV by lauching smitty
# smitty lv
# chlv -x 8192 <lv_name>

Remove an lv
  • To delete BOTH lv and filesystem use rmfs command :
# rmfs -r <mountpoint>

Reduce an lv
  • Want to reduce an lv ? It's not possible, use chfs if a filesystem exists, otherwise :
    • Delete your lv.
    • Re-create your lv.

Rename an lv
  • To rename an lv use chlv command :
# chlv -n <new_name> <old_name>

  • Be carefull after all operation on HCMP cluster you must :
  • Verify where is you ressource group
# clstat
# clstat -o

  • On ACTIVE node :
# varyonvg -b -u <vg_name>

  • On PASSIVE NODE node :
# lspv | grep <vg_name>
# importvg -L <vg_name> <a_disk_who_belong_to_vg>

  • On ACTIVE node :
# varyonvg <vg_name>

  • You can optionaly verify your cluster state with
# clverify

  • It can be usefull to know on which ressource group is located an LV or a VG :
    • VG :
# cllsvg

    • LV :
# cllslv