Logical Volume Manager LVM2

Source: Internet
Author: User

First, LVM logical volume management

the full name of LVM2 is Logical Volume Manager (2 is the version number) and Chinese can be translated as a logical Volume manager. It is mainly through the dm:device mapper module to organize one or more of the underlying block devices into a logical device module, which can logically be regarded as a separate "large disk", Its important function is to flexibly adjust the storage space of the system.


LVM creation Process: PV stage-->VG Stage-->LV phase--format---mount use (create complete);


physical VOLUME,PV, physical volume : Here you need to use the FDISK command to create the partition and adjust the new partition identifier (System ID) to 8e, and then use the Pvcreate command to convert the hard disk into the LVM's lowest physical volume PV;


Volume GROUP,VG, volume group : Using Vgcreate to create a VG,LVM is a large disk with several VG, and the VG is created to view the command Vgdisplay. VG is composed of multiple PV, so added PV equipment is equivalent to expand the boundary of the VG, the function of the VG is similar to the expansion of the partition is no way to directly be applied, so it is necessary to establish the LV, this LV is the true meaning of the logical volume (logical volume), Then in the use of MKFS format to write to the file system, and finally the LV mounted only Linux system can be used;


Physical Extend,pe, physical expansion block: LVM uses the default 4MB PE block, which is the smallest storage block for the entire LVM, which means that our file data is processed by writing to the PE block. Can simply say, PE is a bit like the file system inside the block size, so adjust the size of the PE will affect the capacity of the VG. Here to clarify a concept: PV before adding to the VG is not the concept of PE, we can understand the last VG volume group will be the underlying storage device divided into n pe blocks, different VG block PE size is possible unequal. When the PE block is added to the LV logical volume, we name it Le (logic extend).

LVM Create flowchart

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/8A/wKiom1XlyjOxM311AAKLQ_qS-Uw167.jpg "title=" LVM creation Process "alt=" wkiom1xlyjoxm311aaklq_qs-uw167.jpg "/>


To extend a logical volume:

1) Expand the physical boundary of the VG first # lvextend-l [+]#[MMGGTT]/dev/vg_name/lv_name

2) Modify logical boundary # Resize2fs/dev/vg_name/lv_name


To shrink a logical volume:

1) Uninstall file system First # Umount /dev/vg_name/lv_name

2) force file System detection # e2fsck-f /dev/vg_name/lv_name

3) reduce logical boundary # RESIZE2FS /dev/vg_name/lv_name

4) # lvreduce-l [-]#[mmggtt]/dev/vg_name/lv_name

5) # Mount Mount app


Second, the snapshot function of LVM logical volume

A snapshot volume is similar to a hard link to a file, is another path to the data, the implementation process: constantly monitor the metadata of the target file, once the metadata changes to immediately copy a change in time to send a change of data, then no changes in the data will not need to replicate, so the snapshot volume is generally not too large, However, if it is a long-term storage, there will be enough snapshot volume capacity (= the size of the source file). Also, note the time you executed the snapshot, which is the latest version of the valid data, and the snapshot volume must be in the same partition as the source volume.

LVM Snapshot command:

1) # lvcreate-l # [MMGGTT]-P r-s-N snapshot_lv_name original_lv_name

2) The Mount snapshot volume can be applied


Attached: This is used to say Ext System file system related commands;






This article is from "snail" blog, please be sure to keep this source http://zhangwj.blog.51cto.com/10609913/1690641

Logical Volume Manager LVM2

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.