How to Extend Logical Volume in rhel 7/Centos 7/Oracle 7 Linux LVM



Extend Logical Volume In rhel 7/CentOS 7/ Oracle 7 |In creating Logical Volume section we create testlv with 5GB

We want to increase the size of  the LV from 5GB to 10GB

we can do it two different ways

1. Extend LV Size with new hardDisk 

2. Extend LV Size from extra space of existing VG 

Extend LV Size  with new hardDisk 


We add new disk /dev/sde to LVM using  ‘fdisk ’ command

To do this activity we need to execute the below command. 

# fdisk /dev/sde

  • Type ‘n’ to create new partition

  • Afer that type ‘p’ to create the primary partition 

  • After that we need to enter first and last cylinder value.

  • Then type ‘t’ and we will enter the partition id to create LVM . Now we need to enter 8e and press w to save change.

Now our disk is prepared to add our existing LV. We have to follow the below steps.

 Create Physical volume
Now we create a Physical volume by executing the following command

# pvcreate /dev/sde

To Check PV we use ‘pvdisplay’ command,

Extend Volume group ‘testvg’ to add /dev/sde
# vgextend testvg /dev/sde

To Verify new VG Size we execute  ‘vgdisplay’ command

Extend Logical volume ‘testlv’ we need to follow below command.

# lvextend –L +5G /dev/testvg/testlv



Extend logical volume
Extend logical volume


Here, ‘-L +5G’ means that the size of LV’testlv’ will  increased by 5GB, we can verify the new size by executing ‘lvdisplay’ command.

But the LV Size is not affected.After execute the resize command the new LV Size will be affected.

To resize the filesystem we need to execute the below command.
# resize2fs /dev/testvg/testlv

To verify new LV Size we execute lvdisplay command.


Extend LV Size from  extra space of testvg


Lets take an example  we have 2 GB extra space in our existing Volume Group ‘testvg’ . we add that extra space  to our lv to inctease the size by following  the below process.


Extend Logical volume ‘testlv’ execute the below command.
# lvextend –L +2G /dev/testvg/testlv

To resize the filesystem we need to execute the below command.
# resize2fs /dev/testvg/testlv

To verify new LV Size we execute lvdisplay command.

If this article is helpful to know about Extend Logical Volume In rhel 7/CentOS 7/ Oracle 7 please share and subscribe this article. 



SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment