How to get the size of the logical volumes

From Wiki-UX.info
Jump to: navigation, search


Abstract[edit]

This article describes a Postfix Shell script that reports the size of every LVM Logical Volume. Data is presented in Megabytes.

Script[edit]

# vgdisplay -v | awk '$0 ~ /LV Name/ {TITLE=$3} \
/LV Size/ {printf "%-20s -> %10d MB\n", TITLE, $4}'

Example:

/dev/vg00/lvol1      ->       1536 MB
/dev/vg00/lvol2      ->       4096 MB
/dev/vg00/lvol3      ->       1536 MB
/dev/vg00/lvol4      ->       6144 MB
/dev/vg00/lvol5      ->        512 MB
/dev/vg00/lvol6      ->       3072 MB
/dev/vg00/lvol7      ->       6144 MB
/dev/vg00/lvol8      ->        104 MB
/dev/vg00/lvol9      ->       4096 MB
/dev/vg01/lvol1      ->      34728 MB
/dev/vg02/lvol1      ->      34728 MB

Authors[edit]