Operating System - HP-UX
1832950 Members
2674 Online
110048 Solutions
New Discussion

vgdisplay -v doesn't show the 'Volume group' section header

 
Jdamian
Respected Contributor

vgdisplay -v doesn't show the 'Volume group' section header

Hi

As you can read in manual pages, vgdisplay -v command shows a header for each section. This header is compound of three dashes at the begin of the line, other three dashes at the end and a text between them. For instance:

--- Logical volumes ---

or also

--- Volume groups ---

That is true when only one volume group is specified in the command line.
But if you type several volume groups in the command line (or none for all volume groups) then the header

--- Volume groups ---

is only printed for the first volume group, but not for the remaining ones... For example

$ vgdisplay vg00 vg01

--- Volume groups ---
VG Name /dev/vg00
VG Write Access read/write
Max LV 255
Cur LV 11
Open LV 11
Max PV 16
Cur PV 2
Act PV 2
Max PE per PV 4350
VGDA 4
PE Size (Mbytes) 4
Total PE 8680
Alloc PE 5994
Free PE 2686
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 4
Open LV 4
Max PV 60
Cur PV 18
Act PV 18
Max PE per PV 3473
VGDA 36
PE Size (Mbytes) 4
Total PE 62496
Alloc PE 14848
Free PE 47648
Total PVG 1
Total Spare PVs 0
Total Spare PVs in use 0

8 REPLIES 8
Pete Randall
Outstanding Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

I concur. Is this causing a problem for you? Apparently you think it should be repeated.


Pete

Pete
Robert-Jan Goossens
Honored Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

Hi,

Yes, true.

# vgdisplay -v /dev/vg00
will print info for vg00

# vgdisplay -v /dev/vg01
will print info for vg01

etc.

Robert-Jan.
Massimo Bianchi
Honored Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

If your question is how to get the three minus in front of each output, i would do

for i in vg1 vg2 vgx
do
vgdisplay -v $i
done

Otherwise... what is your question ?

HTH,
Massimo
James R. Ferguson
Acclaimed Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

Hi:

Yes, that's true, replicating the line would be superflous. For instance, if all I wanted was to know the names of all the volume groups, using 'vgdisplay', I could do:

# vgdisplay | grep "VG Name"

...or if I wanted to know where free physical extents were available:

# vgdisplay|grep -e "VG Name" -e "Free PE"

Regards!

...JRF...
Helen French
Honored Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

It's normal. If I want to give an answer to "why?", then I would say: All "volume groups" are listed from the left most column. Since it starts from the same coulmn (like in a spread sheet or formatted script output), I would want only one heading for it. But then if you ask why the "logical volumes" and "physical volumes" repeated, I would say, they both are started from same column position and so it needs to be defferentiated.

May be it's a funny answer ..but just thought in that way !
Life is a promise, fulfill it!
Jdamian
Respected Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

this 'bug' makes crash a script of mine. This script scans standard input and outputs only the desired section. For example:

vgdisplay -v | myscript.sh 'Physical volume'

Each section would be preceded by a header of the format:

--- name of section ----

and it finishes when other '---' section header is found (or and EOF is found).

The use of these headers makes the script very simple:

awk -v SN="Logical Extents" '
BEGIN { S="^ *--- " SN " ---$" }
$1=="---" && $NF==$1 { T=match($0,S)>0; continue }
T==1'

but this 'bug' will force me to retype the script again...
Jdamian
Respected Contributor

Re: vgdisplay -v doesn't show the 'Volume group' section header

The idea of this script was 'filtering only the sections desired' whatever the LVM command used (vgdisplay, lvdisplay, pvdisplay).

I needed to get all the PV names in my box that aren't 'Alternate Links', i.e., that are primary links... anyone would suggest:

vgdisplay -v | grep 'PV Name' | grep -v 'Alternate Link'

but it works fine when no Physical Volume Group exists because, in this case, the 'PV Name' pattern is also displayed in the Physical Volume Group section.
Richard Pugh_2
Advisor

Re: vgdisplay -v doesn't show the 'Volume group' section header

I do the following;

vgdisplay | awk '{print $3} | grep /dev > /var/tmp/vgdetail

vgdisplay -v `cat /var/tmp/vgdetail | awk '{print $1}'` > /var/tmp/`hostname`.vgdetail


It will list the header for each VG.