How to extend a logical volume

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

Collect the required information

# bdf /depots
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg01/lvol1    34816000 4647614 28282894   14% /depots
# vgdisplay /dev/vg01
--- Volume groups ---
VG Name                     /dev/vg01
VG Write Access             read/write
VG Status                   available
Max LV                      255
Cur LV                      1
Open LV                     1
Max PV                      16
Cur PV                      1
Act PV                      1
Max PE per PV               8683
VGDA                        2
PE Size (Mbytes)            4
Total PE                    8682
Alloc PE                    8500
Free PE                     182
Total PVG                   0
Total Spare PVs             0
Total Spare PVs in use      0
VG Version                  1.0.0
# lvdisplay /dev/vg01/lvol1
--- Logical volumes ---
LV Name                     /dev/vg01/lvol1
VG Name                     /dev/vg01
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            34000
Current LE                  8500
Allocated PE                8500
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default
Current size in bytes: '''34816000'''<br>
Available physical extents: '''182'''<br>
Current allocated physical extents: '''8500'''

Extend the logical volume

Extend the logical volume based on the number of (-l) extents or the size in megabytes (-L). Choosing -l or -L it's a matter of personal preference, but we have found that extending the logical volume based on the physical extents and the filesystem on the size in megabytes straight forward.

New size in PE: 8500 PEs + 182 PEs = 8682 PEs
New size in MB: 8682 PEs * 4 (PE size) = 34728 MB
# lvextend -L 34728 /dev/vg01/lvol1

or

# lvextend -l 8682 /dev/vg01/lvol1

Example:

# lvextend -l 8682 /dev/vg01/lvol1
Logical volume "/dev/vg01/lvol1" has been successfully extended.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
# lvdisplay /dev/vg01/lvol1
--- Logical volumes ---
LV Name                     /dev/vg01/lvol1
VG Name                     /dev/vg01
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            34728
Current LE                  8682
Allocated PE                8682
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  strict
IO Timeout (Seconds)        default

Reference