Linux Tutorial: Use LVM logical volume manager to manage flexible storage
1. LVM Introduction
LVM (logical scroll manager) is an inaccessible manager for Linux system devices. It dynamically changes the size of our devices. If the file system requires more space, you can allocate the available space of the volume group to the logical volume. If an error occurs at the beginning of the device, you can register the replacement device as a physical volume through the volume group, in addition, the range of logical volumes can be migrated to new devices, which means that we can change the device without any impact on our business logic, and the services provided by our system will not be affected, this is the most important part. This is also why the logical scroll manager is used.
2. Create LVM
(1) intuitive experience of LVM
To create an LVM, we should first introduce several things:
PV physical volume
VG volume User Group
PE physical expansion Block
LV logical volume
The last one is the device that can be formatted and mounted, but the figure above shows the relationship between the devices:
Read the following sentence carefully:
VG is like a large container. First, we generate PV, regardless of the number of PVS and the size of each PV, and we threw them into the big container of VG, after the container is classified, many units of equal size will appear. For PV generation, we reorganize the specified number of VG units to form a whole. The whole is the LV devices that can be formatted and mounted, which can be expanded or reduced, you can also transfer the business logic in one LV to another LV, And the VG size can also be increased or decreased due to the increase or deletion of PV, this is a complete logical volume group manager, which is very convenient and practical.
Mysqldump and LVM logical volume Snapshot
Comprehensive Introduction and implementation of LVM
LVM instance Creation
Detailed explanation of LVM working principles and Analysis of intermediate and advanced enterprise application instances
(2) Production and use process
1. The first step is the pv creation process. Because pv itself is also a device, we need to generate several PVs:
We generate a new device and change its System ID to the LVM format. We can modify it through t. ls can display all system IDs, and 8e is represented as LVM, we use the same method to generate two other pv devices.
Note: After completion, we can execute the three commands of partx (as mentioned in the previous post, mentioned in the linux discussion 2)
Create PV
We generated three pv devices and checked their information. This is used to generate the vg device.
Create VG
We set the PE size to 8 M (remember that the PE size can only be the power of 2), and then we show the new vg1 information.
Create LV
-L indicates the size and-l indicates the number of PES. To facilitate the period,-L indicates more.
Format and mount the device
For more details, please continue to read the highlights on the next page: