Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

7.2 LVM Logical Volume Manager


May 23, 2021 That's what Linux should learn



Although the hard disk device management technology learned earlier can effectively improve the read and write speed of hard disk equipment and data security, but after the hard disk is divided into areas or deployed as RAID disk array, it is not easy to change the size of the hard disk partition. I n other words, when a user wants to resize a hard disk partition as their actual needs change, they are limited by the "flexibility" of the hard drive. A nother very popular hard disk device resource management technology, LVM (Logical Volume Manager), is needed. LVM allows users to dynamically adjust hard disk resources.

Logical Volume Manager is a mechanism used by Linux system to manage hard disk partitions, which is more theoretical and was created to solve the defect that hard disk devices do not easily modify partition size after creating partitions. A lthough it is theoretically possible to force or shrink traditional hard disk partitions, it can result in data loss. L VM technology adds a logical layer between the hard disk partition and the file system, providing an abstract set of volumes that can combine multiple hard drives into volumes. T his allows users to dynamically adjust the hard disk partition without having to worry about the underlying architecture and layout of the physical hard disk device. The technical architecture of LVM is shown in Figures 7-7.

7.2 LVM Logical Volume Manager

Figure 7-7 The technical structure of the logical volume manager

To help you understand, Mr. Liu Wei came to give an example of eating. F or example, Xiaoming's family want to eat bread but flour is not enough, so my mother borrowed some flour from the old Wang family next door, old Li family, old Zhang family, ready to steam bread to eat. First, you need to knead these flours (physical rolls ( PV, Physical Volume) into a large dough (Roll Group ( VG, Volume Group) and then divide the large dough into a small hoe (logical rolls ( LV, Logic Volume) and each small hoe must weigh a multiply of each scoop of flour (BASIC units (PE, Physical Level).

Physical volumes are at the bottom of the LVM and can be understood as physical hard drives, hard disk partitions, or RAID disk arrays, all of which can be used. A volume group is built on top of a physical volume, a volume group can contain multiple physical volumes, and you can continue to add new physical volumes to a volume group after it is created. L ogical volumes are built with idle resources in a volume group, and logical volumes can dynamically expand or shrink space after they are established. This is the core philosophy of LVM.