Logical volume Management for Linux (LVM)

Source: Internet
Author: User
Tags file system

First, the basic concept of LVM

When you partition a disk to a size plan, sometimes can not determine the total size of the partition to use, and with Fdisk after the partition of the disk, each partition size has been fixed, if the partition set too large, wasted disk space, and the partition set too small, will lead to insufficient space to use the situation, The most common method at this point is to repartition the partition, or link the partition's directory to another partition through a soft connection, which, while temporarily resolving the problem, is causing management trouble. How to solve these problems, LVM is a good way.

LVM, the abbreviation for Logical Volume Manager, is a logical volume management, a mechanism for managing disk partitions under Linux, and LVM is a logical layer between disk partitions and file systems. An administrator can use LVM to dynamically resize a partition without having to repartition the disk. If a new hard drive is added to the system, the new hard disk space can be extended directly to the original partition via LVM.

Second, the use of LVM terminology

Through LVM technology, masking the underlying differences in disk partitions, logically providing a volume concept to the file system, and then creating the appropriate file system on the volumes, before you know LVM, familiarize yourself with several common terms in the LVM, with the following concepts in the LVM.

Physical storage device (physical media): refers to the system's storage device files, such as:/DEV/SDA,/dev/hdb, and so on.

Physical volume (physical volume): PV refers to a hard disk partition or a device (such as a RAID device) that logically looks similar to a hard disk partition.

Volume group (Volume Group): referred to as VG, similar to a physical hard disk in a non-LVM system, an LVM volume group has one or more physical volumes.

Logical volume (logical volume): referred to as LV, similar to the hard disk partition on a non-LVM system, LV is built on VG and can create a file system on LV.

PE (physical extent): PV can be allocated in the smallest storage unit known as the PE,PE size is optional, the default is 4M.

Le (logical extent): the smallest storage unit that can be allocated in LV is called Le, in the same volume group, le is the same size as PE, and one by one corresponds.

Figure 1 clearly illustrates the correspondence between the various components of LVM:

Figure 1 LVM Disk Organization chart

In Figure 1:

There are two physical hard drives that make up the LVM's underlying structure, and the size and model of the two hard disks can be different.

PV can be considered as a partition on the hard disk, so it can be said that physical hard disk a divides two partitions, and physical hard disk B divides 3 partitions.

Then the first three PV formed a volume group VG1, the latter two PV formed a volume group VG2.

Then two logical volumes LV1 and LV2 are divided on the volume group VG1, and a separate logical volume LV3 is divided on the volume group VG2.

Finally, file systems are created on logical volumes LV1, LV2, and LV3, which are used to mount the/usr,/home, and/var partitions, respectively.

Third, the installation of LVM tools

Verify that the LVM is installed by using the following command:

[Root@localhost ~]# Rpm-qa|grep LVM

Lvm2-2.02.16-3.el5

System-config-lvm-1.0.22-1.0.el5

If there is an output similar to the above, the system has already installed LVM, if there is no output, the system is not installed LVM, you can from the system installation CD-ROM or network to find the corresponding RPM package installation, installation method here is not telling.

Now the default Linux release kernel generally supports LVM, so you can use the powerful functionality provided by LVM as long as the LVM tools are installed.

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.