Linux Logical Disk volume management LVM details

Source: Internet
Author: User
Article Title: Linux Logical Disk volume management LVM details. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.


Abstract: The most common hard-to-decide problem that Linux users encounter when installing the Linux operating system is how to correctly evaluate the size of each partition to allocate suitable hard disk space. When a partition space is exhausted, the solution is usually to use a symbolic link or a tool to adjust the partition size (such as PatitionMagic), but this is only a temporary solution, the problem is not fundamentally solved. With the appearance of the Logical Disk volume management function in Linux, these problems have been solved. This article discusses LVM Technology in depth, so that users can easily adjust the size of each partition without downtime.
  
  I. Preface
  
Every Linux user will encounter this dilemma when installing Linux: How to accurately evaluate and allocate the capacity of each hard disk partition when partitioning the system, because the system administrator should not only consider the capacity required by a certain partition, but also anticipate the maximum capacity that may be required after the partition. If the estimation is inaccurate, the Administrator may even need to back up the entire system, clear the hard disk, re-partition the hard disk, and restore the data to the new partition when a partition is insufficient.
  
Although there are many tools available for Dynamic Disk adjustment, such as PartationMagic, it cannot completely solve the problem because a partition may be exhausted again; in addition, this requires a reboot of the system. For many critical servers, shutdown is unacceptable and new hard disks are added, if you want a file system that can span multiple hard drives, the partition adjustment program cannot solve the problem.
  
Therefore, the perfect solution should be to adjust the file system size without downtime, so that the file system can easily span across different disks and partitions. Fortunately, the logical disk volume Management (LVM, LogicalVolumeManager) mechanism provided by Linux is a perfect solution.
  
LVM is short for logical disk volume Management (LogicalVolumeManager). It is a mechanism for managing disk partitions in Linux. LVM is a logical layer built on hard disks and partitions, to improve the flexibility of disk partition management. The LVM system administrator can easily manage disk partitions. For example, you can connect several disk partitions to an entire volume group (volumegroup) to form a storage pool. The administrator can create a logical volume group (logicalvolumes) and create a file system on the logical volume group. Through LVM, administrators can easily adjust the size of storage volume groups and name, manage, and allocate disk storage by group. For example, they can define disk storage by usage: "development" and "sales" instead of using the physical disk names "sda" and "sdb ". When a new disk is added to the system, the LVM Administrator does not need to move the disk files to the new disk to make full use of the new storage space. Instead, the file system can be directly expanded to span the disk.
  
  Ii. Basic Terms of LVM
  
As mentioned above, LVM is a logical layer added between the disk partition and the file system to shield the file system from the underlying disk partition layout and provide an abstract disk volume, create a file system on the disk. First, we will discuss the following LVM terms:
  
* Physical storage media (Thephysicalmedia)
This refers to the storage device of the system, such as/dev/hda1 and/dev/sda. It is the storage unit at the lowest layer of the storage system.
  
* Physical volume (physicalvolume)
A physical volume refers to a hard disk partition or a device (such as RAID) with the same functions as a disk partition logically. It is the basic storage Logical Block of LVM, however, compared with basic physical storage media (such as partitions and disks), it contains management parameters related to LVM.
  
* Volume group (VolumeGroup)
An LVM volume group is similar to a physical hard disk in a non-LVM system and consists of physical volumes. You can create one or more "LVM partitions" (logical volumes) on the volume group. The LVM volume group consists of one or more physical volumes.
  
* Logicalvolume)
The logical volume of LVM is similar to the hard disk partition in a non-LVM system. A file system (such as/home or/usr) can be created on the logical volume ).
  
* PE (physicalextent)
Each physical volume is divided into basic units called PhysicalExtents. pes with unique numbers are the smallest units that can be addressed by LVM. The PE size is configurable. The default value is 4 MB.
  
* LE (logicalextent)
Logical volumes are also divided into the addressable basic units called LE (LogicalExtents. In the same volume group, the LE size and PE are the same and one-to-one correspondence.
  
   
  
First, we can see that the physical volume (PV) is composed of an equivalent basic unit PE.
  
   
  
A volume group consists of one or more physical volumes.
  
   
  
As you can see, PE and LE have a one-to-one relationship. The logical volume is created on the volume group. A logical volume is equivalent to a non-LVM system disk partition. You can create a file system on it.
  
Is the logical relationship between disk partitions, Volume groups, logical volumes, and file systems:
  
   
  
The non-LVM system stores the metadata containing the partition information in the partition table at the starting position of the partition, the logical volume and volume group-related metadata are also stored in the VGDA (volume group descriptor area) at the beginning of the physical volume. VGDA includes PV descriptor, VG descriptor, LV descriptor, and PE descriptor.
  
When LVM is started, the system activates the VG and loads the VGDA to the memory to identify the actual physical storage location of the LV. When the system performs I/O operations, it accesses the actual physical location based on the ing mechanism established by VGDA.

[1] [2] [3] Next page

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.