Tuesday, 17 July 2012

PV info in AIX

Physical Volume concept is easy in AIX as compare to Linux in my experience . In Linux you have to create Physical volume whereas in AIX once a LUN is assigned to OS it is already a Physical volume . Initially the assigned LUN is not accessible for operations, to make it accessible you have to assign a PVID(PVID can be assigned exclusively or inclusively)which actually changes a LUN/disk to a workable physical volume . The LUN is assigned an identifier that is called the physical volume identifier (PVID). The AIX LVM uses this number to identify specific disks. A volume group listed member disk simply with PVIDs.
The PVID for each device is stored in the ODM when the device is configured. The configuration program tries to read the first block of the device. If it succeeds and the first block contains a valid PVID, the PVID value is saved as an attribute in the ODM for that device. Once the PVID is set in the ODM, it can be seen in the output of the lspv  command. In a multipath configuration where we have multiple paths to same logical devices, in this case multiple hdisks show the same PVID in the output of lspv. When the LVM needs to open a device, it selects the first hdisk in the list with the matching PVID.
Physical Volume states :
1. active  -  An active PV can be accessed when VG is varyonvg.
#lspv hdisk2
PHYSICAL VOLUME:hdisk2 VOLUME GROUP:webvg
PV IDENTIFIER:  0000301919439ba5 VG IDENTIFIER: 00003019460f63c7
<strong>PV STATE:active</strong> VG STATE:active/complete
STALE PARTITIONS:  0  ALLOCATABLE:yes
PP SIZE: 4 megabyte(s)LOGICAL VOLUMES:2
TOTAL PPs:  203 (812 megabytes) VG DESCRIPTORS: 2
FREE PPs:192 (768 megabytes)
USED PPs:11 (44 megabytes)
FREE DISTRIBUTION: 41..30..40..40..41
USED DISTRIBUTION:00..11..00..00..00
As in the above example you can see PV STATE as active
2. missing – An missing PV can not be accessed during a varyonvg. But quorum is available so if we repair we can get back the missing PV
#lsvg -p webvg
webvg:
PV_NAME           PV STATE    TOTAL PPs   FREE PPs    FREE DISTRIBUTION
hdisk2          active      599         0           00..00..00..00..00
hdisk3         <strong> missing</strong>     599         0           00..00..00..00..00
Changing the status of a disk to active
#rmdev -dl hdisk2
#cfgmgr
3. removed – If a disk has a status of ‘removed’, you may not be able to mount file systems that exist on the disk
Example:
# lsvg -p webvg
webvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk2 removed 639 238 128..00..00..00..110
hdisk3 active 639 639 128..128..127..128..128
The status of a disk removed as shows on the ‘PV STATE’ . Changing the status of a disk to active:
#chpv -va hdisk3
The opposite of chpv -va is chpv -vr which brings the disk into the removed state. This works only when all logical volumes have been closed on the disk that will be defined as  removed. Additionally, chpv -vr does not work when the quorum will be lost in the volume group after removing the disk.
Command Related with PV
To displays all physical volumes  PVIDs, volume groups, vpath
lspv
To assign a PVID to assigned LUN
chdev -l hdisk7 -a pv=yes
To clears the PVID from the physical volume
chdev -l hdisk7 -a pv=clear
To list detailed information about a PV (vg, pp size, free pp, logical volumes number) as in the above example
lspv hdisk0
To Check the size of a pv in MB
bootinfo -s hdisk1
To make a disk unavailable means pv state will be removed
chpv -vr hdisk2
To makes disk available means pv state will be active
chpv -va hdisk2
To clear clears the boot record on hdisk2
chpv -c hdisk2
To migrates data from hdisk2 to hdisk3 . It will moves all lvs and it can be done in uptime
migratepv hdisk2 hdisk3
To migrates only webl v from hdisk2 to hdisk3
migratepv -l testlv hdisk2 hdisk3
To replace physical volume hdisk2 to hdisk3
replacepv hdisk2 hdisk3
To displays supported storage
lsdev -Pc disk
To list all the logical volumes on the physical volume
lspv -l hdisk2
To displays a map of all physical partitions located on hdisk2
lspv -p hdisk2
To shows which physical partitions are being used for specific logical volumes
lspv -M hdisk1</code>
Migrating a partition to another disk:
1.root@webmanual01: /root # lspv -M hdisk2
hdisk3:294      hd2:1:1
hdisk3:295      hd2:2:1
hdisk3:296      hd2:3:1
hdisk3:297      hd2:4:1
hdisk3:298      hd2:5:1
hdisk3:299      hd2:6:1
hdisk3:300      hd2:7:1
hdisk3:301      hd2:8:1
hdisk3:302      hd2:9:1
hdisk3:303      hd2:10:1
hdisk3:304      hd2:11:1
hdisk3:305      hd2:12:1 < ---------- Here I want to move hd2:number 12 lp: first copy (the lv is mirrored, second copy is on another disk)

2.root@webmanual01: /root # lspv -M hdisk3
hdisk3:90       hd11admin:1:1
hdisk3:91-110                 <--we want to move hd2:12:1 on hdisk2 to hdisk3 on physical partition 91

3.root@webmanual01: /root # migratelp hd2/12/1 hdisk3/91
migratelp: Mirror copy 1 of logical partition 12 of logical volume
hd2 migrated to physical partition 91 of hdisk3.
4.root@webmanual01: /root # lspv -M hdisk2
hdisk3:294      hd2:1:1
hdisk3:295      hd2:2:1
hdisk3:296      hd2:3:1
hdisk3:297      hd2:4:1
hdisk3:298      hd2:5:1
hdisk3:299      hd2:6:1
hdisk3:300      hd2:7:1
hdisk3:301      hd2:8:1
hdisk3:302      hd2:9:1
hdisk3:303      hd2:10:1
hdisk3:304      hd2:11:1
hdisk3:305                    <--physical partition 305 is free now
5.root@webmanual01: /root # lspv -M hdisk3
hdisk3:90      hd11admin:1:1
hdisk3:91      hd2:12:1        <--it is here now
hdisk3:92-110
 
 * Article Source from : Internet