Linux Logical Volume Manager (LVM)

Source: Internet
Author: User

LVM Basics

By using the logical Volume Manager of Linux (Logical Volume Manager, LVM), users can dynamically resize the file system while the system is running, relocate data from one hard drive to another, improve the performance of I/O operations, and provide redundant protection Its snapshot feature allows users to make real-time backups of logical volumes.

For the general user, the most used is the ability to dynamically adjust the file system size. This way, you do not have to worry about how to set the partition size, as long as you reserve some free space on the hard disk, and then adjust the partition size dynamically according to the usage of the system.

In LVM, there are three main concepts:

    • Physical volume (physical Volume, PV): a physical volume can be a disk or a partition on a disk. It provides the storage medium for LVM.
    • Logical Volume Group (Logical Volume Group, LVG): You can think of a logical volume group as a storage pool, or a logical hard disk. Physical volumes and physical volumes can be discontinuous on the hardware, but after adding multiple physical volumes to a logical volume group, you can think of this logical volume group as a contiguous logical hard disk, on which you can create multiple logical volumes (LVS).
    • Logical volumes (Logical Volume, LV): You can divide a volume group into several logical volumes, which is equivalent to dividing several logical partitions on a logical hard disk, and each logical partition can create a specific file system.

Here we can see that the original partition was created directly on the hard disk, and then the file system was created on the partition. When LVM is used, a logical layer is inserted in it, which is equivalent to creating a logical partition on a logical hard disk and then creating a file system on the logical partition.

A new logical layer is inserted, which has a performance penalty for reading and writing a single hard disk, but the benefits are enormous. First, the logical partition size is no longer limited by the actual size of the hard disk, it can be extended to a few hard disks, secondly, the logical partition can be easily resized, backup and other maintenance operations, and if there are multiple hard disks in the system, by setting the logical volume to the physical volume mapping relationship (using LVM striped mapping), can improve the read and write performance of I/O, because reading and writing is performed concurrently on multiple hard disks, which is significantly faster than reading and writing to a single hard disk.

Here is an example of LVM usage:

Example of Logical Volume Manager (LVM) under Linux


An example of a logical Volume manager (LVM) under Linux
In the figure there are two hard disks, where the hard disk 1 points two partitions,/dev/sda1 and/dev/sda2, hard disk 2 does not create partitions. Next the physical volumes are created on/dev/sda2 and/dev/sdb, and then the two physical volumes are added to the logical volume group VG0, and now the logical volume group vg0 looks like a large logical hard disk, where it creates two logical volumes/dev/vg0/lv0 and/dev/vg0/ Lv1.

Finally, create file systems on/DEV/SDA1,/dev/vg0/lv0, and/dev/vg0/lv1, respectively, and mount them to the file system tree, respectively. Does it look like the logical volume is a logical partition?

In the logical volume group VG0, also reserved some of the space is not used, if in use found a logical volume space is not enough, you can in the case of non-stop, directly adjust the logical volume and the size of the file system on it. This is a simple but very useful feature for the server.

Reference:

[1] Linux Logical Volume Manager (LVM) Learning Note http://easwy.com/blog/archives/linux-lvm-learning-notes/

[2] Linux system Mount data disk http://help.aliyun.com/view/13435365.html

[3] Linux LVM HDD Management and LVM expansion http://www.cnblogs.com/gaojun/archive/2012/08/22/2650229.html

Linux Logical Volume Manager (LVM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.