LVM

Logical Volume Management: Dynamic Partitions (create/resize/delete) partitions. 

In simple if you have multiple disks we can group all the disks into a single partition or multiple partitions volumes using LVM.  


Steps:

1) Identify the correct partition attached to the Node and format

2) Create a Physical Volume on the disk

3) Create a Volume Group

4) Create Logical Volume

5) Create Filesystem of the logical Volume


Identify the correct partition attached to the Node:

Identify the Correct Partition attached to the Node using fdisk or lsblk or any other disk management tools

/dev/sdb or /dev/sdc and convert the disk to an LVM disk 

#fdisk /dev/sdb

create a partition with the key "n" assigning +size of capacity

change the type partition with key "t" assigning "8e" (lvm partition) 

Enter key "w" to save changes, 

Press key "p".

#partprobe /dev/sdb (To update the kernel)


Identify the correct partition attached to the Node:

# pvcreate /dev/sdb /dev/sdc

  Physical volume “/dev/sdb” successfully created

  Physical volume “/dev/sdc” successfully created

 you can verify create Physical Volumes using pvscan command

#pvscan

PV /dev/sda2   VG rhel   lvm2 [90.0 GiB / 0    free]

 PV /dev/sdb              lvm2 [100.00 GiB] => Physical Volume 1 newly created. 

PV /dev/sdc              lvm2 [100.00 GiB] => Physical Volume 2 newly created.

for more information for individual Physical volume use 

#pvdisplay /dev/sdc

The default size of extent is 4MB.

If you want to view all physical volume information, we can use “pvdisplay” without any argument.


Create a Volume Group to which the Physical Volume needs to be added:

#vgcreate <vgname> /dev/sdb /dev/sdc

to check full information on voulume group use 

#vgdisplay <vgname>


Create Logical Volume:

To create a Logical volume  with 100G out of 200G available space use below command

# lvcreate -L 100G -n <lvname> <vgname>

if you would like to create with full space use 

# lvcreate -L 200G -n <lvname> <vgname>

to view more informaton on logocal voulme create use

#lvdispaly lvname


Create Filesystem of the logical Volume:

#mkfs.ext4 /dev/vgname/lvname

#mount /dev/vgname/lvname /mnt


Comments

Popular posts from this blog

AWS: Auto Scaling

Jenkins Pipeline

EC2-Instances-awscli