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.
[root@server92 ~]#
[root@server92 ~]# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.1G 1.1G 68% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/sda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
/dev/mapper/MyVolume-MyLogicalVol
291M 11M 266M 4% /MyData
[root@server92 ~]#
[root@server92 ~]# lvextend -L +100M /dev/mapper/MyVolume-MyLogicalVol
Extending logical volume MyLogicalVol to 400.00 MiB
Logical volume MyLogicalVol successfully resized
[root@server92 ~]#
[root@server92 ~]#
[root@server92 ~]# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.1G 1.1G 68% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/sda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
/dev/mapper/MyVolume-MyLogicalVol
291M 11M 266M 4% /MyData
[root@server92 ~]#
[root@server92 ~]#
[root@server92 ~]# resize2fs /dev/mapper/MyVolume-MyLogicalVol
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/MyVolume-MyLogicalVol is mounted on /MyData; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 2
Performing an on-line resize of /dev/mapper/MyVolume-MyLogicalVol to 409600 (1k) blocks.
The filesystem on /dev/mapper/MyVolume-MyLogicalVol is now 409600 blocks long.
[root@server92 ~]#
[root@server92 ~]#
[root@server92 ~]# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgsrv-root
3.3G 2.1G 1.1G 68% /
tmpfs 246M 260K 246M 1% /dev/shm
/dev/sda1 248M 30M 206M 13% /boot
/dev/mapper/vgsrv-home
248M 11M 226M 5% /home
/dev/mapper/MyVolume-MyLogicalVol
388M 11M 358M 3% /MyData
[root@server92 ~]#
Step4: Check the free space of Logical Volume by command df –kh as mentioned above.
If you don't have free space in your Volume group, need to extend Volume group and then extend the Logical Volume. Click here to check how to extend the Volume group .
0 comments:
Post a Comment