Configure/setup LVM on Centos/redhat 7

Configure/setup LVM on Centos/redhat 7

 

  1. First create a partition:

 

To create partition free space must be available on the server.

 

Here we have created 2 GB primary partition.

lvm_html_2462c24

  • Check lvm package installed in the system.

 

# rpm -qa|grep lvm2

Sometimes in minimal OS installation. Package manager not installed LVM package. So we need to install it by yum. Use below command to install lvm package.

#yum install lvm2

 

  •        Create physical volume:

  Next step to create physical volume. Use below command to create physical volume

    # pvcreate /dev/sda4

lvm_html_m4ba11be6

To see created physical volume. Use below command as shown below

# pvscan

lvm_html_7213662f

To see list of physical volumes with all attributes. Use below command as shown below.

 

  •  Create the Volume Group

Volume groups are nothing but one or more physical volume. Here we create volume group with name vol_1.

lvm_html_6f54b21b

 

To list created volume groups use command as shown below.

 

lvm_html_m6934259e

 

 

      • LVM Create: Create Logical Volumes

Now everything is ready to create logical volumes from volume groups. Here we have created logical volume with size 500M.

lvm_html_778edbba

Use lvdisplay command as shown below, to view the available logical volumes with its attributes.

lvm_html_m30671279

 

  • Creating file system on Logical volumes:

Use below command as shown below to create file system on logical volumes

lvm_html_m3148f41

  •   Mount Directory on logical volume:

lvm_html_m5fac20c2

 

  • Resize lvm

You can extend logical volume as shown below:

lvm_html_m3dc291d6

 

To make change in lgoical volume need to run below command

lvm_html_6c0e1c98

Now you can 200 MB storage space has been added to you logical volume

lvm_html_5d45f5e6

Leave a comment

Your email address will not be published.


*