LVMIt is the abbreviation of Logical Volume Manager (logical volume management). It is a mechanism for managing disk partitions in Linux environment. LVM takes one or more disk partitions (PV) as a volume group (VG), which is equivalent to a large hard disk.You can divide a number of logical volumes (LV) on it. When the space of the volume group is not enough, new disk partitions can be added. We can also divide some spaces from the volume group space to use logical volumes that are not enough for space.
Using the fdisk command to partition the new disk, a primary partition, /dev/vdb1, the size 8GB, is used to reread the partition table with the partprobe command.
In the partition process, note that the format is 8e, which is the partition format of LVM.
Using volume vgdisplay to see the volume group information, the following figure shows that the volume group name is CentOS, and the idle size is 0.
We re examined the volume information and found that the free space is 8GB, indicating that /dev/vdb1 has been successfully added.
Using the lvcreate command to divide a new logical volume from the volume group, a logical volume partition named Newlv, the size 4GB is created, and the logical volume information is viewed with the lvdisplay.
The new logical volume can be mounted to the system to store data after formatting. The XFS file system is formatted as CentOS7 using mkfs.xfs.
Size of logical volume vgdata/lvdata changed from 4.00 GiB (1024 extents) to 5.00 GiB (1280 extents).
Logical volume lvdata successfully resized.
Note: if new 5G is added, use lvextend -L +5G /dev/vgdata/lvdata.