LVM
stands for Logical Volume Manager It’s a powerful feature in Linux that allows you to manage disk storage flexibly— far beyond what traditional partitioning allows.
LVM > Logical volume manager
we can combine multiple disk to create a single large virtual space (volume group)
a single large partition/volume can be created from this virtual space (logical volume)
Add the and login the server
to check the disk execute the command lsblk
1, create partition execute the command fdisk /dev/sdb then create the partition select p for the partition and then enter , enter, all are by default or you can choose the partion how partido you want and the size of that
2, change partition type then we have to change the partition type execute the command fdisk /dev/sdb then press t for the type then select the 8E that is the linux lvm type
3, create physical volume (PV) Now we have to create the pv pvcreate /dev/sdb1 /dev/sdc1 after this command pv will created you can check it by pvs
4, create volume group (VG) vgcreate VG1 /dev/sdb1 /dev/sdc1
then you can check it with vgs command
5, create logical volume
lvcreate -L 39.99G -n LV1 VG1 to create the lv lvcreate -l 100%FREE -n LV1 VG1 another way to create the lv
lvremove /dev/VG1/LV1 to remove the LV
6, format LV
mkfs.ext4 /dev/VG1/LV1
now you check file system with blkid command
mount
Temporary mount = mkdir /lv1
mount /dev/VG1/LV1 /lv1
extend the VG
check the VGS
vgextend VG1 /dev/sdc1
now check the vgs size will be increase
now extend the LV1
lvextend -L +10G -r /dev/VG1/LV1 (-r means resize the file system)
lvextend -l +100%FREE -r /dev/VG1/LV1 (to extend the whole free space this the another way to extend the lv )