Creating LVM (Logical Volume Management) Partition in Redhat Linux
Creating LVM (Logical Volume Management) Partition in Redhat Linux

CALL NOW FOR FREE CONSULTATION

+91 9983340133, +91 9001997175

grras

Creating LVM (Logical Volume Management) Partition in Redhat Linux

LVM (Logical Volume Management)

LVM is a tool for logical volume management which is used to allocating disks, mirroring and resizing logical volumes.Logical volume management is widely used technique for deploying logical rather than physical storage.

With LVM we can create logical partitions that can span across one or more physical hard drives. First, the hard drives are divided into physical volumes, then those physical volumes are combined together to create the volume group and finally the logical volumes are created from volume group.

lvm 1

 

Steps for creating LVM partitions:-

  1. Login with root user.
  2. Use “fdisk” command to create and manage partitions.

To view existing partitions use “fdisk -l”

Now according to the space available in particular hard disk, create different partitions.

For creating partitions use “fdisk<physical hard disk>”

e.g.:- #fdisk  /dev/sda

  • Press n to create new disk partition,
  • Press p for primary disk partition,
  • Press 1 to denote 1st partition,
  • Press enter twice for taking all space from physical hard disk that we entered,
  • Press t for changing its type to lvmlinux,
  • Press 8e for lvmlinux,
  • Finally press w to save and come out
  1. Use “partx” command for telling kernel about new partition.

“partx<path of new partition>”

e.g. #partx /dev/sda7

Creating Physical Volume

Use “pvcreate” command for creating physical volume.

“pvcreate<new partition>”

#pvcreate /dev/sda7

“pvdisplay” for display all physical volume information.

#pvdisplay

Creating Volume Group

“vgcreate  vgname  pvname”

  • This will create the volume group with specified physical volume. The size of the vg is the sum of the size of different pv’s associated.
  • #vgcreate vg0  /dev/sda7

“vgdisplay ”

  • To show all volume group information.

Creating logical volume

Use “lvcreate” command for creating logical volume.

“lvcreate –size<specify size>–n lvname  vgname”

#lvcreate  –size +2G  -n  lv  /dev/vg0

This command will create a logical volume of size 2GB that will be taken from volume group vg0.

 

Next step is to format the logical volume to support linux file system.

“mkfs.ext4 <path of lv>”

#mkfs.ext4  /dev/vg0/lv

Finally mount the logical volume into lvm partition.

Before mounting create a mount point

“mkdir /lvm”

#mkdir  /lvm

Mount point created as /lvm

“mount /dev/vgname/lvname/lvm”

#mount  /dev/vg0/lv  /lvm

This will mount the logical volume.

Leave a Reply

Your email address will not be published. Required fields are marked *