Thursday, October 18, 2012

It is very easy to extend already created logical volume, if you have free space in volume group. You need to understand the details about existing volume group from which this logical volume created before extending the logical volume. Follow the following steps:

Step1: Check the Name of Volume Group of respective logical Volume. You can see it by two commands, lvs or lvdisplay.

[root@server92 ~]#

[root@server92 ~]# lvs

LV VG Attr LSize Origin Snap% Move Log Copy% Convert

MyLogicalVol MyVolume -wi-ao 300.00m

home vgsrv -wi-ao 256.00m

root vgsrv -wi-ao 3.31g

swap vgsrv -wi-ao 544.00m

[root@server92 ~]#

Step2: Check free space in Volume Group.

[root@server92 ~]#

[root@server92 ~]# vgdisplay MyVolume

--- Volume group ---

VG Name MyVolume

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 2

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 1

Open LV 1

Max PV 0

Cur PV 1

Act PV 1

VG Size 496.00 MiB

PE Size 4.00 MiB

Total PE 124

Alloc PE / Size 75 / 300.00 MiB

Free PE / Size 49 / 196.00 MiB // Free Space in Volume Group.

VG UUID ZQcrfp-FfVC-3WoP-ev8q-n854-AYEb-ZrPAex

[root@server92 ~]#

[root@server92 ~]#

Step3: You can extend the logical volume with free space present in its own Volume Group(VG). Currently, we have 196MB free space in Volume group of logical volume (MyLogicalVol). We will extend the partition /dev/mapper/MyVolume-MyLogicalVol by 100MB.