Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of logical Volume Management in Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you the "Linux system logic volume management example analysis", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and study the "Linux system logic volume management example analysis" this article.

Overview of LVM

LVM is the abbreviation of Logical Volume Manager (logical Volume Management). It is a mechanism for managing disk partitions in Linux environment. It is implemented by Heinz Mauelshagen on Linux 2.4 kernel. A common and difficult problem encountered by Linux users when installing Linux operating system is how to correctly evaluate the size of each partition in order to allocate appropriate hard disk space. The common disk partition management method cannot change the size of a logical partition after it has been partitioned. When a logical partition cannot hold a file, the file cannot be stored across multiple partitions because of the limitations of the upper file system. So it can't be put on other disks at the same time. When a partition runs out of space, the solution is usually to use symbolic links, or use a tool to resize the partition, but this is only a temporary solution, not a fundamental solution to the problem. With the emergence of the logical volume management function of Linux, these problems are easily solved, and users can easily adjust the size of each partition without downtime.

Logical Volume Manager (LogicalVolumeManager) is essentially a virtual device driver, adding a new level of abstraction between block devices and physical devices in the kernel, as shown in the figure. It can combine several disks (physical volumes, PhysicalVolume) to form a storage pool or volume group (VolumeGroup). LVM can create new logical devices by dividing logical volumes of different sizes (LogicalVolume) from the volume group each time. The underlying raw disk is no longer directly controlled by the kernel, but by the LVM layer. For upper-layer applications, volume groups replace disk blocks as the basic unit of data storage. LVM manages the physical extents of all physical volumes and maintains the mapping between logical and physical extents. LVM logic devices provide the same functions as physical disks to upper-layer applications, such as file system creation and data access. However, LVM logical devices are not subject to physical constraints, logical volumes do not have to be contiguous space, it can span many physical volumes, and can be resized at any time. It is easier to manage disk space than physical disks.

From the point of view of user mode application, LVM logical volume is equivalent to an ordinary block device, and its read and write operation is exactly the same as that of ordinary block device. From the physical device layer, LVM is relatively independent of the underlying physical devices, and shields the differences between different physical devices. Therefore, to realize the continuous protection of data on the LVM layer, we do not need to consider each specific physical device separately, and avoid the problems caused by the differences between physical devices in the process of data replication. From the kernel implementation principle of LVM, LVM is another path between the request communication from the kernel general block device layer to the disk device driver layer, that is, the LVM management mapping layer is inserted between the general block device layer and the disk device driver layer to intercept certain requests for processing.

Users provide interfaces through lvm and rely on the kernel to create a series of LVM logical volumes. All read and write operations on lvm logical volumes will eventually be intercepted by LVM under the general block device layer for further processing. The further processing here mainly refers to the completion of the mapping of the write request, which is to split and relocate the requested data according to the actual situation, so that the request and data can be distributed to the actual physical devices.

LVM management command

LVM paper creation process

Physical volume (PV) is the basic storage device of LVM volume mechanism. It is necessary to first create physical volume, then form volume group (VP), and finally build logical volume (LV).

Create a physical volume

Add three disks to the PC and take effect after rebooting. For more information on the process, please see the previous blog.

After saving and exiting, do the same for disk cPowerD.

Configuration completed. Check results.

Create a physical volume, as shown above

Create a volume group

Use the vgcreate command

Create a logical volume

Create formula lvcreate-L capacity size-n logical volume name volume group name

If the logical volume space is small, you can take the space out of the volume group to expand.

After the logical volume is created, it must be formatted and mounted before it can be used

Automatic mount

The above is all the contents of the article "sample Analysis of logical Volume Management in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report