Showing posts with label AIX - LVM. Show all posts
Showing posts with label AIX - LVM. Show all posts

Partial mirrored issue with the LV:

Partial mirrored issue with the LV:

mohisrv# lslv -m mohilv
mohilv:/mohifs
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0064 hdisk2            0079 hdisk8
0002  0065 hdisk2            0080 hdisk8
0003  0066 hdisk2            0081 hdisk8
0004  0067 hdisk2
0005  0068 hdisk2
0006  0069 hdisk2
0007  0070 hdisk2
0008  0071 hdisk2
0009  0026 hdisk2

mohisrv# lsvg -l mohivg
mohivg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
loglv02             jfs2log    1       1       1    open/syncd    N/A
0516-1147 : Warning - logical volume fslv58 may be partially mirrored.
mohilv              jfs2       9       12      3    open/syncd    /mohifs

mohisrv# rmlvcopy mohilv 1 hdisk8
0516-022 lquerypv: Illegal parameter or structure value.
0516-304 getlvodm: Unable to find device id 0000000000000000 in the Device
        Configuration Database.
0516-848 rmlvcopy: Failure on physical volume 0000000000000000, it may be missing
        or removed.


mohisrv# mklvcopy mohilv 2 hdisk3
0516-1509 mklvcopy: VGDA corruption: physical partition info for this LV is invalid.
0516-842 mklvcopy: Unable to make logical partition copies for
        logical volume.
0516-1199 mirrorvg: Failed to create logical partition copies
        for logical volume bblv.
0516-1200 mirrorvg: Failed to mirror the volume group.

How to remove the partial mirrored copied from hdisk8?
We need to use low-level command lreducelv (becareful)

Syntax:
lreducelv -l -s

cat /tmp/file.txt
00c2545ba95e1e32 0079 0001
00c2545ba95e1e32 0080 0002
00c2545ba95e1e32 0081 0003

Preparation:
LV ID: 00c2545b00004c000000010ccff96e80.29
No of LPs: 3 (wc -l /tmp/file.txt)
Text file: /tmp/file.txt

Now the time to correct it!

lreducelv -l 00c2545b00004c000000010ccff96e80.29 -s 3 /tmp/file.txt

Now the lvm deallocates all PP's of your partially mirror from hdisk8

Note: After these, lslv -m will show correct output, but LVCB or VGDA could still show this wrongly
odmget -q name=mohilv CuAt | grep -p copies     --> Command to check

Hence it is safer if we update both LVCB and VGDA with the correct value

putlvodm -c 1 00c2545b00004c000000010ccff96e80.29
putlvcb -c 1 mohilv

Syntax:
putlvodm -c COPYNUM  LV ID
putlvcb -c COPYNUM  LV NAME


Thats it we resolved the partial mirror issue of the mohilv

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