Physical volumes are combined into volume groups (VGs). This creates a pool of disk space out of which logical volumes can be allocated.
Within a volume group, the disk space available for allocation is divided into units of a fixed-size called extents. An extent is the smallest unit of space that can be allocated, Within a physical volume, extents are referred to as physical extents.
A logical volume is allocated into logical extents of the same size as the physical extents. The extent size is thus the same for all logical volumes in the volume group. The volume group maps the logical extents to physical extents.
Extend a file system created on LVM disk
Add a new HDD or create a new disk in the VM
To see the new disk, you need to force a hard scan | echo "- - -" > /sys/class/scsi_host/host0/scan | |
Create a partition LVM in new disk (sdx)
|
fdisk /dev/sdx t w |
Partition type Write modification to disk |
Create a physical volume | pvcreate /dev/sdx1 | LMV partition 1 of sdx |
Display volume group | vgdisplay | Get you vgname you want extend |
Extend you volume group | vgextend vgname /dev/sdx1 | |
Display logical volume | lvdisplay | Get your /path/lvname to extend |
Extend you lvname | lvextend -L +size /path/lvname /dev/sdx1 | |
Extend you fs | resize2fs /path/lvname |
Create a new file system on LVM disk
Create or add a new disk /dev/sdx | find /dev/sdx with fdisk -l | |
Create a physical volume | pvcreate /dev/sdx | |
Create a volume group | vgcreate vg_name /dev/sdx | |
Create a logical volume | lvcreate -l 100%VG -n lv_name vg_name | |
Format the logical volume | mkfs.ext4 /dev/mapper/vg_name-lv_name | |
Thank's to /https://www.rootusers.com/how-to-increase-the-size-of-a-linux-lvm-by-adding-a-new-disk/