LVM: Introduction

Source: Internet
Author: User
Keywords linux linux lvm linux lvm commands
When planning the size of a disk partition, it is often impossible to determine the size of the space to be used by the partition. And use fdisk, gdisk

After the tool partitions the disk, the size of each partition is fixed. If the partition is set too large, the disk space will be wasted; if the partition is set too small, it will cause insufficient space. For the problem that the partition is too small, you can re-divide the disk partition, or link the directory of this partition to another partition through a soft link. Although this can temporarily solve the problem, it brings trouble to management. Similar questions can be passed
LVM to solve.
Note: The demo environment of this article is ubuntu 16.04.

What is LVM

LVM is the abbreviation of Logical Volume Manager, which is generally translated as "Logical Volume Management" in Chinese. It is a mechanism for managing disk partitions under Linux. LVM is a logical layer built between disk partitions and file systems. System administrators can use LVM to dynamically adjust the size of the partition without repartitioning the disk. If a new hard disk is added to the system, the newly added hard disk space can be directly expanded to the original disk partition through LVM.

The advantages of LVM are as follows:

* The file system can span multiple disks, so the size is no longer limited by physical disks.
* The file system size can be dynamically expanded when the system is running.
* The important data can be redundantly mirrored to multiple physical disks.
* You can easily export the entire volume group and import it to another machine.

LVM also has some disadvantages:

* The reducevg command must be used when removing a disk from a volume group (this command requires root privileges and is not allowed to be used in a snapshot volume group).
* When one disk in a volume group is damaged, the entire volume group will be affected.
* Because of the addition of a logical layer, storage performance will be affected.
The advantages of LVM are very useful for server management, but the help for desktop systems is not so significant, so we need to decide whether to apply LVM according to the usage scenario.

Basic concepts in LVM

Through LVM technology, the underlying differences of disk partitions can be shielded, and a volume concept is logically provided to the file system, and then corresponding file systems are established on these volumes. The following are some of the main concepts involved in LVM.

Physical Media: refers to the storage device files of the system, such as /dev/sda, /dev/sdb, etc.
PV (Physical Volume): Refers to hard disk partitions or devices that are logically similar to hard disk partitions (such as RAID devices).
VG (Volume Group): Similar to physical hard disks in non-LVM systems, an LVM volume group consists of one or more PV (physical volumes).
LV (Logical Volume): Similar to disk partitions on non-LVM systems, LV is established on VG, and file system can be established on LV.
PE (Physical Extent): The smallest storage unit that can be allocated in PV (physical volume) is called PE, and the size of PE can be specified.
LE (Logical Extent): The smallest storage unit that can be allocated in LV (logical volume) is called LE. In the same volume group, the size of LE and the size of PE are the same, and there is a one-to-one correspondence.
It can be understood that LVM divides the partition of the hard disk into smaller units (PE), and then uses these units to form larger things that look like partitions (PV), and then use PV
Put together what looks like a hard disk (VG), and finally create a partition (LV) on this new hard disk. The file system is built on LV, which adds a layer of abstraction (LVM) between the physical hard disk and the file system.

Related Article

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.