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

LV & Current le in adjacent columns

Hey,
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
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Please use plain text.
Honored Contributor
Massimo Bianchi
Posts: 2,472
Registered: ‎01-18-1999
Message 2 of 4 (59 Views)

Re: LV & Current le in adjacent columns

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

#!/sbin/sh
if [ $# != 2 ]
then
printf "\n"
printf " Specular_lv.sh - Version 1.0 \n"
printf "\n"
printf "\n"
printf " Usage: specular_lv.sh sourcevg targetvg \n"
printf "\n"

exit 1
fi
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..


HTH,
Massimo
Please use plain text.
Honored Contributor
Fred Ruffet
Posts: 1,366
Registered: ‎08-17-2003
Message 3 of 4 (59 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}')
do
for LEline in $(lvdisplay -v $lv|grep current|tr -s " " ":")
do
echo "$lv $LEline"
done
done

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Please use plain text.
Trusted Contributor
Stuart Abramson
Posts: 278
Registered: ‎07-15-1999
Message 4 of 4 (59 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
Please use plain text.
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