====== AIX Logical Volume Manager (LVM) ======
lsjfs2 /mymntpt\\
dumpfs /mymntpt
===== Definitions =====
Represents a hard disk (hdisk0).The smallest allocation unit in the LVM. All PPs within a VG are the same size, usually 4 or 8 MB.A set of one or more PVs which form a single storage pool. You can define multiple VGs on each AIX system.One or more PPs. A file system resides on top of an LV. Only one LV is mapped to a file system. A LV can't span across multiple VG. Up to 255 LVs in a VG
LOGICAL PARITITION (LP)
One or more PPs. LP represents a mirrored copy of a PP. Up to two copies of a PP can be mirrored
resulting in a LP count of three (2 mirrors plus original).
Volume Group Descriptor Area (VGDA)
Information about all the LVs and PVs within a VG. The first 64K of a PV is reserved for this area
- defined in .
The VGDA consists of
BOOTRECORD: - first 512 bytes. Allows the Read Only System (ROS) to boot system
BAD BLK DIRECTORY - found in
LVM RECORD - found in
Volume Group Status Area (VGSA)
Information about which PPs that are stale and which PVs are missing within a VG. The LVM and SCSI
driver reserves somewhere between 7-10% of the available disk space for LVM maps, etc.
Physical Volume ID (PVID)
The PVID is an amalgamation of the machine’s serial number (from the systems EPROMs) and the date that
the PVID is being generated. This combination insures theextremely low chance of two disks being created
with the same PVID. Finally, when a system is booted, the disk configurator goes and looks at the PVID
sitting on each disk platter and then compares that to an entry in ODM. If the entry is found, then
the disk is given the hdiskX name that is associated with the ODM entry for the PVID.
Quorum
Quorum is a sort of “sanity” check that LVM uses to resolve possible data confliction and prevent data
corruption. Quorum is a method by which 51% or more quorum votes must be available to a volume group
before LVM actions can continue. Quorum is issued to a disk in a volume group according to how the
disk was created within the volume group. When a volume group consists of one disk, there are two
VGDA’s on that disk. Thus, this single disk volume group has a quorum vote of 2. When another disk is
added to the volume group with an “extendvg”, then this new disk gets one VGDA, but the original, first
disk still retains the two VGDA’s. When the volume group has been extended to three disks, the third
disk gets the spare VGDA sitting on the first disk and then each disk has a quorum vote of 1. Every
disk after the third disk is automatically given one VGDA, and thus one vote.
Volume Group ID (VGID)
Just as the PVID is a soft serial number for a disk, the VGID is the soft serial number for the volume
group. It is this serial number, not the volume group’s ascii name, which all low level LVM commands
reference. Additionally, it is the basis for the LVIDs created on that VGID.
Logical Volume Control Block (LVCB)
The logical volume control block (lvcb) consists of the first 512 bytes of a logical volume. This area
holds important information such as the creation date of the logical volume, information about mirrored
copies, and possible mount points in a journaled filesystem.
Logical Volume ID (LVID)
The LVID is the soft serial number used to represent the logical volume to the LVM libraries and low
level commands. The LVID is created from the VGID of the volume group, a decimal point, and a number
which represents the order which the logical volume was created on the volume group.
===== Tools =====
diagnostic
diag - used to hot swap the disk
cfgmgr - used mak sure the new disk is seen
to add new disk from the scsi0 controller
cfgmgr -l scsi0
Create/Remove hard disk cfgmgr -l scsi0
mkdev -c disk -l
rmdev -dl
Physical Volumes
display lspv
lspv (detailed)
lspv -l (list logical volumes)
lspv -p (physical partition usage)
PVID chdev -l -a pv=yes
chdev -l -a pv=clear
Note: PVID's are automatically added when the disk is placed into a vg
adding chdev -l -a pv=yes (new)
chpv -v a (adds back the removed disk)
removing chpv -v r
change physical attributes chpv -a y (changes allocatable state to YES)
chpv -a n (changes allocatable state to NO)
moving migratepv
===== Volume Groups =====
display lsvg
lsvg (detailed)
lsvg -l (list all logical volumes in goup)
lsvg -p (list all physical volumes in group)
lsvg -o (lists all varied on)
lsvg -M (lists assicated disks and state)
## Details volume group info for the hard disk
lqueryvg -Atp
lqueryvg -p -v (Determine the VG ID# on disk)
lqueryvg -p -L (Show all the LV ID#/names in the VG on disk)
lqueryvg -p -P (Show all the PV ID# that reside in the VG on disk)
varyon / activate a volume group
varyonvg
varyonvg -f (force)
varyonvg -s (maintenance mode can use VG commands but lv 's cannot be opened for i/o access)
varyoffvg
Note: the varyon command activiates the volume goup which means it is available for use
ODM related ## Determine if the ODM and VGDA are correct (in sync)
getlvodm -u
## tries to resync VGDA, LV control blocks and ODM
synclvodm
## If the message 0516-366 lsvg: Volume group is locked is ever seen
putlvodm -K `getlvodm -v `
creating mkvg -y -s
Check volume group type (normal, big,scalable):
[root@aix01]/root# readvgda hdisk6 | grep readvgda_type
..... readvgda_type: smallvg
[root@aix01]/root# readvgda hdisk5 | grep readvgda_type
..... readvgda_type: bigvg
[root@aix01]/root# readvgda hdisk8 | grep readvgda _type
..... readvgda_type: svg
mkvg -y datavg -s 4 hdisk1
Note: the PP size will be the size of the physical partition size you want 4MB, 8MB
extending extendvg
reducing reducevg -d
## removes the PVID from the VGDA when a disk has vanished without using the reducevg command
reducevg
removing
varyoffvg
exportvg
Note: the export command nukes everything regardingthe volume goup in the ODM and /etc/filesystems
checking
## check to see if underlying disk has grown in size
chvg -g
Note: use this command if you are using SAN LUN's that have increased in size
change volume attributes ## auto vary on a volume at system start
chvg -a y
# Turns on/off quorum checking on a volume group
chvg -Q [y|n]
renaming
varyoffvg
lsvg -p (obtain disk names)
exportvg
import -y
varyonvg
mount -a
importing
importvg -y
importvg (will use rootvg as default vg)
exporting
varyoffvg
exportvg
===== Logical Volume =====
Note: if the volume has an active paging space this must be turned off before
Logical Volumes display
lslv
lslv -l (list all physical volumes in logical volume)
lslv -m (list ppartition mapping)
## Display lv control block information
getlvcb -AT
creating
mklv <# of PP's>
mklv -y <# of PP's>
## Create a mirrored named logical volume
mklv -y -c <# of PP's>
## create a JFSlog logical Volume
mklv -y -t jfslog <# of PP's>
extending
extendlv
extendlv
reducing/resizing see filesystem below
removing
rmlv
moving
migratepv -l
adding a mirror to a non-mirrored volume
mklvcopy -s n
removing a mirror copy from a mirrored volume
rmlvcopy
rmlvcopy (specified pv)
synchronize logical volume
syncvg -p
syncvg -v
syncvg -l
mirror any unmirrored volumes
mirrorvg
unmirrorvg
change volume attributes ## Enable the bad-block relocation policy
chlv -b [y|n]
renaming
chlv -n
Miscellaneous ## Initialises an LV for use as an JFSlog
logform
===== Filesystem =====
Display filesystems
lsfs -a
lsfs -q (detailed)
[root@aix1]/root# lsfs -q
Name Nodename Mount Pt VFS Size Options Auto Accounting
/dev/hd4 -- / jfs2 4194304 -- yes no
(lv size: 4194304, fs size: 4194304, block size: 4096, sparse files: yes, inline log: no, inline log size: 0, EAformat: v1, Quota: no, DMAPI: no, VIX: yes, EFS: no, ISNAPSHOT: no, MAXEXT: 0, MountGuard: no)
/dev/hd1 -- /home jfs2 1048576 -- yes no
(lv size: 1048576, fs size: 1048576, block size: 4096, sparse files: yes, inline log: no, inline log size: 0, EAformat: v1, Quota: no, DMAPI: no, VIX: yes, EFS: no, ISNAPSHOT: no, MAXEXT: 0, MountGuard: no)
[root@aix1]/root# lsjfs2
#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct:OtherOptions:LvSize:FsSize:BlockSize:Sparse:InlineLog:InlineLogSz:EAformat:Quota:DMAPI:VIX:EFS:ISNAPSHOT:maxext:MountGuard
/:/dev/hd4:jfs2::bootfs:4194304:rw:yes:no::4194304:4194304:4096:yes:no:0:v1:no:no:yes:no:no:0:no:
/home:/dev/hd1:jfs2:::1048576:rw:yes:no::1048576:1048576:4096:yes:no:0:v1:no:no:yes:no:no:0:no:
/usr:/dev/hd2:jfs2::bootfs:6684672:rw:yes:no::6684672:6684672:4096:yes:no:0:v1:no:no:yes:no:no:0:no:
/var:/dev/hd9var:jfs2::bootfs:4194304:rw:yes:no::4194304:4194304:4096:yes:no:0:v1:no:no:yes:no:no:0:no:
Note: use the '-q' to see if the logical volume size is bigger than the filesystem size
create ## create new filesystem, -A means to mount after restart
crfs -v jfs -d -m -A yes -a log=INLINE
## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystems at the specified size
crfs -v jfs2 -g -m -a size=
Note: if all filesystems have been removed from a logical volume then the logical volume is removed as well.
Resize a filesystem
chfs -a size=
chfs -a size=1G /var (specific size, can be used to increase and decrease)
chfs -a size=+1G /var (increase by 1GB)
chfs -a size=-1GB /var (reduce by 1GB)
Note: this will automatically increase or decrease the underlying logical volume as well
freeze/unfreeze chfs -a freeze=