LVM: Display basic information about Physical Volumes, Volume Groups and Logical Volumes
Article Number: 206 | Rating: Unrated | Last Updated: Sun, Jun 3, 2018 10:01 AM
LVM: Display basic information about Physical Volumes, Volume Groups and Logical Volumes
# Display information about a Physical Volume within a Volume Group
# Small script to display some interesting information about Physical Volumes # ------------------------------------------------------------------------------------------ # The default is to print every known physical volume in the system along with # its physical disk name, physical volume identifiers (PVIDs), to which volume # group (if any) the physical volume belongs, and the state of the volume group # as active if the volume group is varied on or concurrent if it is varied on # in concurrent mode root@<server>:/root#> lspv hdisk0 00c6413062a7f098 rootvg active hdisk1 00c641308076d6da rootvg active hdisk2 00c6413062c3f43d None hdisk3 00c641308076d74a None root@<server>:/root#> lspv -l 00c6413062a7f098 pvid=00c6413062a7f098: LV NAME LPs PPs DISTRIBUTION MOUNT POINT localoptlv 80 80 00..00..80..00..00 /local/opt hd1 8 8 00..00..08..00..00 /local/home lv_dumplv 32 32 32..00..00..00..00 N/A hd11admin 1 1 00..00..01..00..00 /admin hd10opt 12 12 00..00..12..00..00 /opt hd6 122 122 00..122..00..00..00 N/A hd8 1 1 00..00..01..00..00 N/A hd5 2 2 02..00..00..00..00 N/A hd9var 8 8 00..00..08..00..00 /var hd3 12 12 00..00..12..00..00 /tmp hd4 5 5 00..00..05..00..00 / hd2 21 21 00..05..16..00..00 /usr root@<server>:/root#> lspv -p 00c6413062a7f098 pvid=00c6413062a7f098: PP RANGE STATE REGION LV NAME TYPE MOUNT POINT 1-2 used outer edge hd5 boot N/A 3-112 free outer edge 113-144 used outer edge lv_dumplv sysdump N/A 145-266 used outer middle hd6 paging N/A 267-283 free outer middle 284-288 used outer middle hd2 jfs2 /usr 289-289 used center hd8 jfs2log N/A 290-293 used center hd4 jfs2 / 294-309 used center hd2 jfs2 /usr 310-317 used center hd9var jfs2 /var 318-329 used center hd3 jfs2 /tmp 330-409 used center localoptlv jfs2 /local/opt 410-417 used center hd1 jfs2 /local/home 418-429 used center hd10opt jfs2 /opt 430-430 used center hd11admin jfs2 /admin 431-431 used center hd4 jfs2 / 432-575 free inner middle 576-719 free inner edge DISP="1"; ls -l /dev/hdisk* | awk '{print $10 " " $5 $6}' | sed -e "s:/dev/::" -e "s/,/ /" | while read DISK MAJOR MINOR do SIZE=$(bootinfo -s $DISK) LUN=$(lscfg -l $DISK | sed -e "s/^.*L//" -e "s/ .*$//" | cut -c-2) VG=$(lspv | awk -vSDISK=$DISK '$1 == SDISK {print $3}') [ "$DISP" == "1" ] && echo -e "DISK \t SIZE \t LUN \t MAJOR \t MINOR \t VG" && DISP="0" echo -e "$DISK \t $SIZE \t $LUN \t $MAJOR \t $MINOR \t $VG" done DISK SIZE LUN MAJOR MINOR VG hdisk0 76800 81 17 0 rootvg hdisk1 13312 82 17 3 rootvg hdisk2 20480 83 17 4 None hdisk3 10240 84 17 2 None # To show the WWID/UUID of a physical volume we can use '-u' option that will give us the
# following informations in columns: # - Physical disk name # - Physical volume identifiers (PVIDs) # - Volume group (if any), or label (if any), belonging to # - The state of the volume group (Active|Concurrent|Locked) # - Unique device identifier (UDID) # - Universally Unique Identifier (UUID) # for instance:
lspv -u
hdisk0 00f7136b54a8b920 rootvg active 3924240C50 14DAB108806OPEN-V07HITACHIfcp05VDASD03AIXvscsi 69250cca-5886-21d0-8355-2ddc6327095c hdisk1 none None 3924240C50 14DAB317606OPEN-V07HITACHIfcp05VDASD03AIXvscsi 7847a5c4-4a9a-197d-ee28-94780dbaad1b hdisk2 none None 3924240C50 14DAB317906OPEN-V07HITACHIfcp05VDASD03AIXvscsi fdd6bae3-96e2-acb5-a33f-8f65c8aca390 hdisk3 none None 3924240C50 14DAB317A06OPEN-V07HITACHIfcp05VDASD03AIXvscsi 68a80ae5-2da4-12a7-1f60-2497727958b5 hdisk4 none None 3924240C50 14DAB10A806OPEN-V07HITACHIfcp05VDASD03AIXvscsi 747df427-ef61-2cbc-41a0-c4b345e36f59 hdisk5 none None 3924240C50 14DAB109206OPEN-V07HITACHIfcp05VDASD03AIXvscsi 1999849a-f121-de41-ed45-524d5125ca0b hdisk6 none None 3924240C50 14DAB109306OPEN-V07HITACHIfcp05VDASD03AIXvscsi b626b025-176b-11e2-1b81-0a434eed29da hdisk7 none None 3924240C50 14DAB109406OPEN-V07HITACHIfcp05VDASD03AIXvscsi 04b40450-742c-c4bb-ba4d-2643d3c0028c hdisk8 none None 3924240C50 14DAB109506OPEN-V07HITACHIfcp05VDASD03AIXvscsi 0d0370f7-41ef-9fa9-bddb-0d839c0ce11f hdisk9 none None 3924240C50 14DAB316206OPEN-V07HITACHIfcp05VDASD03AIXvscsi a533c1f6-8855-de6f-f643-d839281cc9df hdisk10 none None 3924240C50 14DAB300D06OPEN-V07HITACHIfcp05VDASD03AIXvscsi 1a943977-07a4-d4e9-ee37-2d8074aedda2 hdisk12 00f66148d7610585 rootvg active 3924240C50 14DAB10ED06OPEN-V07HITACHIfcp05VDASD03AIXvscsi 5a679182-d0dc-fea5-f301-262c85d4dbee hdisk11 none None 3924240C50 14DAB318906OPEN-V07HITACHIfcp05VDASD03AIXvscsi 5209b601-ec6b-b77c-a841-6070fd334a7f hdisk13 none None 3924240C50 14DAB30C106OPEN-V07HITACHIfcp05VDASD03AIXvscsi add30c19-9d8b-2031-65b8-152b4a590d18 # Display information about Volume Groups # ------------------------------------------------------------------------------------------ root@<server>:/root#> lsvg rootvg dbf1vg dbf2vg fravg rdo1vg rdo2vg root@<server>:/root#> lsvg -l rootvg rootvg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT hd5 boot 2 4 2 closed/syncd N/A hd6 paging 122 244 2 open/syncd N/A hd8 jfs2log 1 2 2 open/syncd N/A hd4 jfs2 5 10 2 open/syncd / hd2 jfs2 21 42 2 open/syncd /usr hd9var jfs2 8 16 2 open/syncd /var hd3 jfs2 12 24 2 open/syncd /tmp localoptlv jfs2 80 160 2 open/syncd /local/opt hd1 jfs2 8 16 2 open/syncd /local/home hd10opt jfs2 12 24 2 open/syncd /opt hd11admin jfs2 1 2 2 open/syncd /admin lv_dumpsec sysdump 32 32 1 open/syncd N/A lv_dumplv sysdump 32 32 1 open/syncd N/A livedump jfs2 2 2 1 closed/syncd N/A # LPs: Number of logical partitions in the logical volume. # PPs: Number of physical partitions used by the logical volume. # PVs: Number of physical volumes used by the logical volume. # Logical volume state: State of the logical volume. Opened/stale indicates the logical volume is # open but contains partitions that are not current. Opened/syncd indicates the logical volume # is open and synchronized. Closed indicates the logical volume has not been opened. root@<server>:/root#> lsvg -p rootvg rootvg: PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION hdisk0 active 719 415 110..17..00..144..144 hdisk1 active 479 173 39..00..00..38..96 # Display information about Logical Volumes # ------------------------------------------------------------------------------------------ root@<server>:/root#> lslv lv_u02 LOGICAL VOLUME: lv_u02 VOLUME GROUP: dbf1vg LV IDENTIFIER: 00c8425d00004c000000012de24522f1.1 PERMISSION: read/write VG STATE: active/complete LV STATE: opened/syncd TYPE: jfs2 WRITE VERIFY: off MAX LPs: 1024 PP SIZE: 512 megabyte(s) COPIES: 1 SCHED POLICY: parallel LPs: 587 PPs: 587 STALE PPs: 0 BB POLICY: relocatable INTER-POLICY: minimum RELOCATABLE: yes INTRA-POLICY: middle UPPER BOUND: 128 MOUNT POINT: /u02 LABEL: /u02 MIRROR WRITE CONSISTENCY: on/ACTIVE EACH LP COPY ON A SEPARATE PV ?: yes Serialize IO ?: NO root@<server>:/root#> lslv -l lv_u02 lv_u02:/u02 PV COPIES IN BAND DISTRIBUTION hdiskpower0 400:000:000 40% 000:160:160:080:000 hdiskpower20 100:000:000 20% 020:020:020:020:020 hdiskpower22 030:000:000 0% 000:000:000:010:020 hdiskpower23 040:000:000 50% 000:020:020:000:000 hdiskpower24 017:000:000 0% 000:000:000:000:017 # Copies: # * Number of logical partitions containing at least one physical partition (no copies) on the physical volume # * Number of logical partitions containing at least two physical partitions (one copy) on the physical volume # * Number of logical partitions containing three physical partitions (two copies) on the physical volume # In band: % of physical partitions on the physical volume that belong to the logical volume and were allocated # within the physical volume region specified by Intra-physical allocation policy. # Distribution: Number of physical partitions allocated within each section of the physical volume: outer edge, # outer middle, center, inner middle, and inner edge of the physical volume. |