LVM
Logic Volume ManagerLVM is a software that allows Logical Partition Management. LVM is use for extend and reduce size of the partition according to the requirement.
Physical Volume(PV)
Adding the new hardware for LVM is called Physical Volume.
Volume Group(VG)
Collection of physical volume is called Volume group.
Logical Volume(LV)
The space of volume group which is used for storing the data is called Logical Volume.
Implement of Logical Volume
#fdisk /dev/sda ( to create a new partition of 8e type)Create Physical Volume
#pvcreate /dev/sda12 (sda12 is your new partition or new HDD)
#pvdisplay
Create Volume Group
#vgcreate kaushal /dev/sda12 (here kaushal is VG Name and /dev/sda12 is PV)
#vgcreate -S 16M kaushal /dev/sad12 (you can also create VG through this command. -s showing the size for VG 16m is the size for VG. kaushal is the name of VG)
#vgdisplay
#vgextend kaushal /dev/sda13 (to extend the size of VG)
#resize2fs -f /dev/kaushal/thakur
Create Logical Volume
#lvcreate --size +1000M -n thakur kaushal ( here thakur is LV name and kaushal is VG name)
#lvdisplay
after that mount the volume
#mount /dev/kaushal/thakur /rhel (kaushal=VG, thakur=LV, Rhel=Mount Directory)
After that format the volume
#mkfs.ext3 /dev/kaushal/thakur
Extend The Size Of LV
#lvextend --size +1000M /dev/kaushal/thakur#resize2fs -f /dev/kaushal/thakur
Remove LV, VG, PV
#lvremove lvname#vgremove vgname
#pvremove pvname
LV Reducing
first of all unmount the volume#umount /kaushal/thakur /rhel
#e2fsck -f /dev/kaushal/thakur
#regize2fs -f /dev/kaushal/thakur 500M
#lvreduse --size 500M /dev/kaushal/thakur
#mount /dev/kaushal/thakur /rhel
Permanent Mount Of VG
#vim /etc/fstab
create here entry for your VG
