Re: LV & Current le in adjacent columns (332 Views)
Respected Contributor
Posts: 772
Registered: ‎04-30-2004
Message 1 of 4 (332 Views)
Accepted Solution

LV & Current le in adjacent columns

How I can do lvdisplay and arrange the LV Name and Current in adjacant columns. I will assign points. I got list of LV's and I need to check for current LE assigned and create the same on Test box. I appreciate the help very much and will surely assign points..
Thanks and regards
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Honored Contributor
Posts: 2,472
Registered: ‎01-18-1999
Message 2 of 4 (332 Views)

Re: LV & Current le in adjacent columns

i do not clearly understand your question, but some time ago i did this script:

if [ $# != 2 ]
printf "\n"
printf " - Version 1.0 \n"
printf "\n"
printf "\n"
printf " Usage: sourcevg targetvg \n"
printf "\n"

exit 1
vgdisplay -v $1 | awk ' /LV Name/{ print $3 } /LV Size/{ print $4 }'| paste -s -d"\t\n" - | tr "/" " " | awk -v NOMEVG=$2 '{ print "lvcreate -n", $3, "-L", $4, NOMEVG }'

It will print to video the instruction to re-create the vg, changing the name.

It will NOT issue any real command to create logical volumes..

Honored Contributor
Posts: 1,366
Registered: ‎08-17-2003
Message 3 of 4 (332 Views)

Re: LV & Current le in adjacent columns

As Massimo, I'm not really sure I understand your question. From what I understand, even if this is not an exact solution, this may help (or not :)

This will put LV name in front of each LE description line of "lvdisplay -v".

for lv in $(vgdisplay -v vg00|grep "LV Name"|awk '{print $NF}')
for LEline in $(lvdisplay -v $lv|grep current|tr -s " " ":")
echo "$lv $LEline"



"Reality is just a point of view." (P. K. D.)
Trusted Contributor
Posts: 278
Registered: ‎07-15-1999
Message 4 of 4 (332 Views)

Re: LV & Current le in adjacent columns

lvdisplay /dev/emc01/lvol1 | awk '
/LV Name/ {LV=$3}
/LE/ {LE=$3}
END {print LV, LE}
b. Yields:

/dev/emc01/lvol1 6250
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.