LVM

Put a PVID on a disk
chdev -l hdisk1 -a pv=yes

Remove a PVID from a disk
chdev -l hdisk1 -a pv=clear

List all PVs in a system (along) with VG membership
lspv

Create a VG called datavg using hdisk1 using 64 Meg PPs
mkvg -y datavg -s 64 hdisk1

Create a Enhanced Concurrent VG (HACMP-ES must be installed) with not auto varyon
mkvg -y vgname -f -n -C hdisk3

Create a LV on (previous) datavg that is 1 Gig in size
mklv -t jfs2 -y datalv datavg 16

List all LVs on the datavg VG
lsvg -l datavg

List all PVs in the datavg VG
lsvg -p datavg

Take the datavg VG offline
varyoffvg datavg

Remove the datavg VG from the ODM
exportvg datavg

Import the VG on hdisk5 as datavg
importvg -y datavg hdisk5

Vary-on the new datavg VG (can use importvg -n)
varyonvg datavg

List all VGs (known to the ODM)
lsvg

List all VGs that are on line
lsvg -o

Check to see if underlying disk in datavg has grown in size
chvg -g datavg

Move a LV from one PV to another
migratepv -l datalv01 hdisk4 hdisk5

Move LVs from hdisk0 to hdisk1
migratepv hdisk0 hdisk1

To replace a PP from hdisk5 to hdisk6 (hdisk6 must be None state)
replacepv hdisk5 hdisk6

Delete a VG by removing all PVs with the reducevg command.
reducevg hdisk3 (-d removes any LVs that may be on that PV)

To Read VGDA information on hdisk0
lqueryvg -Atp hdisk0

List the VG id in which the PV hdisk0 resides
lqueryvg -p hdisk0 -v

List all the LV ids/names in the VG where PV hdisk0 resides
lqueryvg -p hdisk3 -L

Lists all the PV ids that reside in the VG where hdisk3 resides
lqueryvg -p hdisk3 -P
(or)
lqueryvg -g 0053485a00004c00000000f8e9a3e72c

To find the WWN of the fcs0 HBA adapter
lscfg -vl fcs0 |grep Network

To check the major number of the VG
ls -l /dev/vgname

To check the free major number
lvlstmajor

Synchronizes logical volume copies that are not current
syncvg -v vgname

Synchronizes the LV lv00 so that all copies are identical
syncvg -l lv00

Updates the ODM for a specific VG with the information stored in the VGDA
redifinevg -d hdisk0 rootvg

To Check the LVCB (Logical Volume Control Block)
getlvcb -TA LVNAME (eg: getlvcb -TA fslv03)

To Check all the configured physical volumes
getlvodm -C

To Check all the FREE configured physical volumes
getlvodm -F

To Identify the VG ID of mohivg
getlvodm -v mohivg

To Check the VGDA information and its timestamp
readvgda /dev/hdisk1

Synchronizes or rebuilds the logical volume control block, the device configuration database (CuDv), and the volume group descriptor areas on the physical volumes
synclvodm

To check current boot disk
bootinfo -b

Rebuilds the ODM database for a LV, by reading the VGDA.
synclvodm vgname lvname (eg: synclvodm rootvg hd1)

Script to Find the Missing PVs (Note:The VGs should be variedon)
lsvg > /tmp/doc/vgs
for i in `cat /tmp/doc/vgs`
do
lsvg -p $i |grep -i missing
done

Script to Find the Stale PPs (Note:The VGs should be variedon)
lsvg > /tmp/doc/vgs
for i in `cat /tmp/doc/vgs`
do
lsvg -l $i |grep -i stale
done

Mirroring rootvg to hdisk1 extendvg rootvg hdisk1
mirrorvg rootvg hdisk1
bosboot -ad hdisk0
bosboot -ad hdisk1
bootlist -m normal hdisk0 hdisk1

Mount a CD ROM to /mnt
mount -rv cdrfs /dev/cd0 /mnt

Create a VG, LV, and FS, mirror, and create mirrored LV
mkvg -s 256 -y datavg hdisk1 (PP size is 1/4 Gig)
mklv -t jfs2log -y dataloglv datavg 1
logform /dev/dataloglv
mklv -t jfs2 -y data01lv datavg 8 (2 Gig LV)
crfs -v jfs2 -d data01lv -m /data01 -A yes
extendvg datavg hdisk2
mklvcopy dataloglv 2 (Note use of mirrorvg in next example)
mklvcopy data01lv 2
syncvg -v datavg
lsvg -l datavg will now list 2 PPs for every LP
mklv -c 2 -t jfs2 -y data02lv datavg 8 (2 Gig LV)
crfs -v jfs2 -d data02lv -m /data02 -A yes
mount -a

Move a VG from hdisk1 to hdisk2 extendvg datavg hdisk2
mirrorvg datavg hdisk2
unmirrorvg datavg hdisk1
reducevg datavg hdisk1

Find the free space on PV hdisk1
lspv hdisk1 (Look for \FREE PPs")

For the LVM_GS_RLEAVE (Errpt Error)
Check the ps -ef |grep gsclvmd and check the Conc VGs state

No comments:

Post a Comment