Operating System - HP-UX
1748229 Members
3979 Online
108759 Solutions
New Discussion юеВ

Re: LV & Current le in adjacent columns

 
SOLVED
Go to solution
Prashant Zanwar_4
Respected Contributor

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."
3 REPLIES 3
Massimo Bianchi
Honored Contributor
Solution

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
Fred Ruffet
Honored Contributor

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.)
Stuart Abramson
Trusted Contributor

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