Aix: Step by step the configuration of LVM in aix
In this blog, I am showing you step by step the configuration of LVM
1. How to configure Physical Volume.
2. How to configure Volume Group.
3. How to configure Logical Volumes
4. How to configure File system.
1<<<<<<<Physical Volume>>>>>>>>
a) display
lspv
lspv <pv> (detailed)
lspv -l <pv> (list logical volumes)
lspv -p <pv> (physical partition usage)
b) PVID
chdev -l <pv> -a pv=yes
chdev -l <pv> -a pv=clear
Note: PVID's are automatically added when the disk is placed into a vg
c) adding
chdev -l <pv> -a pv=yes (new)
chpv -v a <pv> (adds back the removed disk)
d) removing
chpv -v r <pv>
e) change physical attributes
chpv -a y <pv> (changes allocatable state to YES)
chpv -a n <pv> (changes allocatable state to NO)
f) moving
migratepv <old pv> <new pv>
2<<<<<<<<Volume Group>>>>>>>>>>>
a) display
lsvg
lsvg -L <vg> (detailed)
lsvg -l <vg> (list all logical volumes in goup)
lsvg -p <vg> (list all physical volumes in group)
lsvg -o (lists all varied on)
lsvg -M <vg> (lists assicated disks and state)
b) varyon
varyonvg <vg>
varyonvg -f <vg> (force)
varyonvg -s <vg> (maintenance mode can use VG commands but lv 's cannot be opened for i/o access)
varyoffvg <vg>
Note: the varyon command activiates the volume goup which means it is available for use
c) creating
mkvg -y <vg> -s <PP size> <pv>
mkvg -y datavg -s 4 hdisk1
Note: the PP size will be the size of the physical partition size you want 4MB, 8MB
d) extending
extendvg <vg> <pv>
e) reducing
reducevg -d <vg> <pv>
## removes the PVID from the VGDA when a disk has vanished without using the reducevg command
reducevg <vg> <PVID>
f) removing
varyoffvg <vg>
exportvg <vg>
reducevg -df <vg> hdisks
Note: the export command nukes everything regardingthe volume goup in the ODM and /etc/filesystems
g) renaming
varyoffvg <old vg name>
lsvg -p <old vg name> (obtain disk names)
exportvg <old vg name>
import -y <new vg name> <pv>
varyonvg <new vg name>
mount -a
h) importing
importvg -y <vg> <pv>
importvg <pv> (will use rootvg as default vg)
3<<<<<<<< Logical Volumes >>>>>>>>>>>>
a) display
lslv <lv>
lslv -l <lv> (list all physical volumes in logical volume)
lslv -m <lv> (list partition mapping)
b) creating
mklv -y <lv name> <vg> <# of PP's> <pv>
## Create a mirrored named logical volume
mklv -y <lv> -c <copies 2 or 3> <vg> <# of PP's> <pv>
## create a JFSlog logical Volume
mklv -y <lv name> -t jfslog <vg> <# of PP's> <pv>
c) extending
extendlv <lv> <additonal # of PP's>
extendlv <lv> <size of volume in B||M|G>
d) removing
rmlv <lv>
e) moving
migratepv -l <lv> <old pv> <new pv>
f) adding a mirror to a non-mirrored volume
mklvcopy -s n <lv> <copies 2 or 3> <pv>
g) removing a mirror copy from a mirrored volume
rmlvcopy <lv> <copies 1 or 2>
rmlvcopy <lv> <copies 1 or 2> <pv> (specified pv)
unmirrorvg <vg> <pv>
h) renaming
chlv -n <new lv name> <old lv name>
4<<<<<<<<<<<Filesystems>>>>>>>>>>>>>
a) display
lsfs
lsfs -q <fs> (detailed)
Note: use the '-q' to see if the logical volume size is bigger than the filesystem size
b) create
## create new filesystem, -A means to mount after restart
crfs -v jfs -d <lv> -m <mountpoint> -A yes
## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystems at the specified size
crfs -v jfs2 -g <vg> -m <mountpoint> -a size=<size in 512k blocks|M|G) -A yes
Note: there are two types of filesystems jfs and jfs2, jfs2 allows you to decrease the filesystem size , you cannot reduce a jfs filesystem
c) remove
rmfs <fs>
Note: if all filesystems have been removed from a logical volume then the logical volume is removed as well.
d) resize
chfs -a size=<new size> <fs>
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
e) change
## Change the mountpoint
chfs -m <new mountpoint> <fs>
## Do not mount after a restart
chfs -A no <fs>
## Mount read-only
chfs -p ro <fs>
1. How to configure Physical Volume.
2. How to configure Volume Group.
3. How to configure Logical Volumes
4. How to configure File system.
1<<<<<<<Physical Volume>>>>>>>>
a) display
lspv
lspv <pv> (detailed)
lspv -l <pv> (list logical volumes)
lspv -p <pv> (physical partition usage)
b) PVID
chdev -l <pv> -a pv=yes
chdev -l <pv> -a pv=clear
Note: PVID's are automatically added when the disk is placed into a vg
c) adding
chdev -l <pv> -a pv=yes (new)
chpv -v a <pv> (adds back the removed disk)
d) removing
chpv -v r <pv>
e) change physical attributes
chpv -a y <pv> (changes allocatable state to YES)
chpv -a n <pv> (changes allocatable state to NO)
f) moving
migratepv <old pv> <new pv>
2<<<<<<<<Volume Group>>>>>>>>>>>
a) display
lsvg
lsvg -L <vg> (detailed)
lsvg -l <vg> (list all logical volumes in goup)
lsvg -p <vg> (list all physical volumes in group)
lsvg -o (lists all varied on)
lsvg -M <vg> (lists assicated disks and state)
b) varyon
varyonvg <vg>
varyonvg -f <vg> (force)
varyonvg -s <vg> (maintenance mode can use VG commands but lv 's cannot be opened for i/o access)
varyoffvg <vg>
Note: the varyon command activiates the volume goup which means it is available for use
c) creating
mkvg -y <vg> -s <PP size> <pv>
mkvg -y datavg -s 4 hdisk1
Note: the PP size will be the size of the physical partition size you want 4MB, 8MB
d) extending
extendvg <vg> <pv>
e) reducing
reducevg -d <vg> <pv>
## removes the PVID from the VGDA when a disk has vanished without using the reducevg command
reducevg <vg> <PVID>
f) removing
varyoffvg <vg>
exportvg <vg>
reducevg -df <vg> hdisks
Note: the export command nukes everything regardingthe volume goup in the ODM and /etc/filesystems
g) renaming
varyoffvg <old vg name>
lsvg -p <old vg name> (obtain disk names)
exportvg <old vg name>
import -y <new vg name> <pv>
varyonvg <new vg name>
mount -a
h) importing
importvg -y <vg> <pv>
importvg <pv> (will use rootvg as default vg)
3<<<<<<<< Logical Volumes >>>>>>>>>>>>
a) display
lslv <lv>
lslv -l <lv> (list all physical volumes in logical volume)
lslv -m <lv> (list partition mapping)
b) creating
mklv -y <lv name> <vg> <# of PP's> <pv>
## Create a mirrored named logical volume
mklv -y <lv> -c <copies 2 or 3> <vg> <# of PP's> <pv>
## create a JFSlog logical Volume
mklv -y <lv name> -t jfslog <vg> <# of PP's> <pv>
c) extending
extendlv <lv> <additonal # of PP's>
extendlv <lv> <size of volume in B||M|G>
d) removing
rmlv <lv>
e) moving
migratepv -l <lv> <old pv> <new pv>
f) adding a mirror to a non-mirrored volume
mklvcopy -s n <lv> <copies 2 or 3> <pv>
g) removing a mirror copy from a mirrored volume
rmlvcopy <lv> <copies 1 or 2>
rmlvcopy <lv> <copies 1 or 2> <pv> (specified pv)
unmirrorvg <vg> <pv>
h) renaming
chlv -n <new lv name> <old lv name>
4<<<<<<<<<<<Filesystems>>>>>>>>>>>>>
a) display
lsfs
lsfs -q <fs> (detailed)
Note: use the '-q' to see if the logical volume size is bigger than the filesystem size
b) create
## create new filesystem, -A means to mount after restart
crfs -v jfs -d <lv> -m <mountpoint> -A yes
## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystems at the specified size
crfs -v jfs2 -g <vg> -m <mountpoint> -a size=<size in 512k blocks|M|G) -A yes
Note: there are two types of filesystems jfs and jfs2, jfs2 allows you to decrease the filesystem size , you cannot reduce a jfs filesystem
c) remove
rmfs <fs>
Note: if all filesystems have been removed from a logical volume then the logical volume is removed as well.
d) resize
chfs -a size=<new size> <fs>
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
e) change
## Change the mountpoint
chfs -m <new mountpoint> <fs>
## Do not mount after a restart
chfs -A no <fs>
## Mount read-only
chfs -p ro <fs>
Great
ReplyDelete