Monday 19 September 2016

Extend the Logical volume in RHEL 6

Hi today I'm going to explain how to extend the logical volume. Before that we must know about what is PV ( physical volume ) VG ( Volume Group ) and LV ( Logical Volume ). So It's simple concept only I will explain that with my way of understanding. If you thought it's have any issue please command me with the correction. 

  • PV ( Physical Volume )
Physical volume means it has the answer with it's name. Physical disk is divided into physical volume so only we can create other volumes. So first we are going to create physical volume from physical disk.

fdisk -l

this command will show you the list of physical disks in the system.

after this i will show you the image that will give you the clear look of creating physical volume.

http://tr1.cbsistatic.com/hub/i/2015/05/07/67088bde-f48a-11e4-940f-14feb5cc3d2a/10042011figure_a.jpg

In this you see the 'n' it's call new partition. It will show the command action with two options. 
e extended
p primary partition

extended partition means like a container inside we can create many logical volume into this extended volume it will solve the drive limitation.

primary partition usually used to install OS but it can be used to logical volume.


we are going to extend the volume only so we are giving 'p'.

then partition number it's shows the physical volume number. It's a new physical volume so we can provide number and also I'm going to use full size of it so i gave '1'.
then it will ask sector number just give enter to default and again enter for default for last sector.

then 't' t means type in this we can provide the file system type like swap, ext3, ext4, etc .... 

8e means LVM partition.

then 'p' means print. we can see the created created linux LVM.

finally we give 'w' it means save. now we are going to create physical volume with following command

pvcreate /dev/sdd1

That's all we he physical volume.


  • VG ( Volume Group )
VG is a group of partition volume so we can have many resize-able LVM. It's a set of physical disk.

We can view the volume group with following command.

vgs 

It will show the VG in list. On that we have make a note the name of VG name that we are going to extend. Now we are going to extend the VG with following command.

vgextend vgname /dev/sdd1

now you can check th VG with following command.

vgdisplay vgname

That's all we complete the Volume Group.


  • LV ( Logical Volume )

LV is a partitions for linux. We can take size from VG and create LV for our Linux system. Now we extend the LV with following command.

lvextend -l +50G /dev/vgname/lv_root

and resize the partition with following command

resize2fs /dev/vgname/lv_root

now verify the file system with following command

df -h

That's all I have missed so many commands. but this commands enough to extend the logical volume.

No comments:

Post a Comment

Permanent hostname setup for RHEL7

Step 1 Set the host name on NMTUI tool like following nmtui set host name   then save and exit Step 2 add the following l...