I'm in need to find out the LVM size of image vm001
. Let's say I have a LVM volume called /dev/VGgroup/vm001
. Now using lvdisplay
I can find out the size:
--- Logical volume ---
LV Name /dev/VGgroup/vm001
VG Name VGgroup
LV UUID i0aYKs-Hpfv-q64V-9Rqu-6Wrq-eV3C-pZzo0D
LV Write Access read/write
LV Status available
# open 2
LV Size 25.00 GB
Current LE 6400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:41
How can I find out the LV size using a script/command which will output just 25
? I know with awk
you can find strings horizontally, but not vertically (as far as I know).
Edit
There are more Logical Volumes, using lvdisplay | awk '/LV Size/ { print $3 }'
will output all sizes (obviously), how do I only get the size of the volume I want to? (in this case vm001
).