From Wiki-UX.info

Wiki-UX / Logical Volume Manager / How to create a logical volume report of a volume group
Jump to: navigation, search

How to create a logical volume report of a volume group

Abstract

This article presents a script that can be used to create a report of the configuration of the Logical volumes available on a LVM Volume Group. Two, versions are presented.

Contents


Abridged Report

if [ -f /tmp/lvol.out ]; then
   rm /tmp/lvol.out
fi
 
for lv in $(vgdisplay -v /dev/<vgname> | awk '$0 ~ /LV Name/ {print $3}')
do
   lvdisplay -v $lv | head -n 30
   echo
done > /tmp/lvol.out

Example:

The following is an output example of the report on /dev/vg00 volume group.

# cat /tmp/lvol.out
--- Logical volumes ---
LV Name                     /dev/vg00/lvol1
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            1792
Current LE                  224
Allocated PE                448
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   off
Allocation                  strict/contiguous
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        224       224
   /dev/disk/disk10        224       224
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        00000 current  /dev/disk/disk10        00000 current
   00001 /dev/disk/disk12        00001 current  /dev/disk/disk10        00001 current
   00002 /dev/disk/disk12        00002 current  /dev/disk/disk10        00002 current
   00003 /dev/disk/disk12        00003 current  /dev/disk/disk10        00003 current
   00004 /dev/disk/disk12        00004 current  /dev/disk/disk10        00004 current
   00005 /dev/disk/disk12        00005 current  /dev/disk/disk10        00005 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol2
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            4096
Current LE                  512
Allocated PE                1024
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   off
Allocation                  strict/contiguous
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        512       512
   /dev/disk/disk10        512       512
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        00224 current  /dev/disk/disk10        00224 current
   00001 /dev/disk/disk12        00225 current  /dev/disk/disk10        00225 current
   00002 /dev/disk/disk12        00226 current  /dev/disk/disk10        00226 current
   00003 /dev/disk/disk12        00227 current  /dev/disk/disk10        00227 current
   00004 /dev/disk/disk12        00228 current  /dev/disk/disk10        00228 current
   00005 /dev/disk/disk12        00229 current  /dev/disk/disk10        00229 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol3
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            1024
Current LE                  128
Allocated PE                256
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   off
Allocation                  strict/contiguous
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        128       128
   /dev/disk/disk10        128       128
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        00736 current  /dev/disk/disk10        00736 current
   00001 /dev/disk/disk12        00737 current  /dev/disk/disk10        00737 current
   00002 /dev/disk/disk12        00738 current  /dev/disk/disk10        00738 current
   00003 /dev/disk/disk12        00739 current  /dev/disk/disk10        00739 current
   00004 /dev/disk/disk12        00740 current  /dev/disk/disk10        00740 current
   00005 /dev/disk/disk12        00741 current  /dev/disk/disk10        00741 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol4
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            1024
Current LE                  128
Allocated PE                256
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        128       128
   /dev/disk/disk10        128       128
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        00864 current  /dev/disk/disk10        00864 current
   00001 /dev/disk/disk12        00865 current  /dev/disk/disk10        00865 current
   00002 /dev/disk/disk12        00866 current  /dev/disk/disk10        00866 current
   00003 /dev/disk/disk12        00867 current  /dev/disk/disk10        00867 current
   00004 /dev/disk/disk12        00868 current  /dev/disk/disk10        00868 current
   00005 /dev/disk/disk12        00869 current  /dev/disk/disk10        00869 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol5
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            6144
Current LE                  768
Allocated PE                1536
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        768       768
   /dev/disk/disk10        768       768
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        00992 current  /dev/disk/disk10        00992 current
   00001 /dev/disk/disk12        00993 current  /dev/disk/disk10        00993 current
   00002 /dev/disk/disk12        00994 current  /dev/disk/disk10        00994 current
   00003 /dev/disk/disk12        00995 current  /dev/disk/disk10        00995 current
   00004 /dev/disk/disk12        00996 current  /dev/disk/disk10        00996 current
   00005 /dev/disk/disk12        00997 current  /dev/disk/disk10        00997 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol6
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            512
Current LE                  64
Allocated PE                128
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        64        64
   /dev/disk/disk10        64        64
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        01760 current  /dev/disk/disk10        01760 current
   00001 /dev/disk/disk12        01761 current  /dev/disk/disk10        01761 current
   00002 /dev/disk/disk12        01762 current  /dev/disk/disk10        01762 current
   00003 /dev/disk/disk12        01763 current  /dev/disk/disk10        01763 current
   00004 /dev/disk/disk12        01764 current  /dev/disk/disk10        01764 current
   00005 /dev/disk/disk12        01765 current  /dev/disk/disk10        01765 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol7
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            6144
Current LE                  768
Allocated PE                1536
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        768       768
   /dev/disk/disk10        768       768
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        01824 current  /dev/disk/disk10        01824 current
   00001 /dev/disk/disk12        01825 current  /dev/disk/disk10        01825 current
   00002 /dev/disk/disk12        01826 current  /dev/disk/disk10        01826 current
   00003 /dev/disk/disk12        01827 current  /dev/disk/disk10        01827 current
   00004 /dev/disk/disk12        01828 current  /dev/disk/disk10        01828 current
   00005 /dev/disk/disk12        01829 current  /dev/disk/disk10        01829 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol8
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            6144
Current LE                  768
Allocated PE                1536
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        768       768
   /dev/disk/disk10        768       768
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        02592 current  /dev/disk/disk10        02592 current
   00001 /dev/disk/disk12        02593 current  /dev/disk/disk10        02593 current
   00002 /dev/disk/disk12        02594 current  /dev/disk/disk10        02594 current
   00003 /dev/disk/disk12        02595 current  /dev/disk/disk10        02595 current
   00004 /dev/disk/disk12        02596 current  /dev/disk/disk10        02596 current
   00005 /dev/disk/disk12        02597 current  /dev/disk/disk10        02597 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol9
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            24
Current LE                  3
Allocated PE                6
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        3         3
   /dev/disk/disk10        3         3
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk12        03360 current  /dev/disk/disk10        03360 current
   00001 /dev/disk/disk12        03361 current  /dev/disk/disk10        03361 current
   00002 /dev/disk/disk12        03362 current  /dev/disk/disk10        03362 current
 
 
--- Logical volumes ---
LV Name                     /dev/vg00/lvol10
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            10240
Current LE                  1280
Allocated PE                1280
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk12        978       978
   /dev/disk/disk10        302       302
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1
   00000 /dev/disk/disk12        03363 current
   00001 /dev/disk/disk12        03364 current
   00002 /dev/disk/disk12        03365 current
   00003 /dev/disk/disk12        03366 current
   00004 /dev/disk/disk12        03367 current
   00005 /dev/disk/disk12        03368 current
 
--- Logical volumes ---
LV Name                     /dev/vg00/test1
VG Name                     /dev/vg00
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               1
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            16
Current LE                  2
Allocated PE                4
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  non-strict
IO Timeout (Seconds)        default
 
   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
   /dev/disk/disk10        2         4
 
   --- Logical extents ---
   LE    PV1                     PE1   Status 1 PV2                     PE2   Status 2
   00000 /dev/disk/disk10        03665 current  /dev/disk/disk10        03667 current
   00001 /dev/disk/disk10        03666 current  /dev/disk/disk10        03668 current

Exhaustive Report

if [ -f /tmp/lvol.out ]; then
   rm /tmp/lvol.out
fi
 
for lv in $(vgdisplay -v /dev/<vgname> | awk '$0 ~ /LV Name/ {print $3}')
do
   lvdisplay -v $lv
done > /tmp/lvol.out

Authors

This page was last modified on 17 July 2010, at 18:25. This page has been accessed 1,609 times.