Configuring LVM under Linux

Source: Internet
Author: User

Installation Environment: CentOS 6.8

An Introduction to LVM

LVM is the abbreviation for Logical Disk volume management (logicalvolumemanager), which is a Linux environment forDisk partitioningA mechanism for management, LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. Through LVMSystem administratoryou can easily manage disk partitions, such as connecting several disk partitions to a single block of volume group (volumegroup), forming aStorage pools. Administrators can create logical volume groups (logicalvolumes) at will on a volume group and further create file systems on logical volume groups. The administrator can easily adjust the size of the storage volume group through LVM, and canDisk storagename, manage, and assign as a group, such as defined by usage: "Development" and "sales" instead of usingPhysical DiskThe name "SDA" and "SDB". And when a new disk is added to the system, the LVM administrator does not have to move the disk's files to the new disk to take full advantage of the new storage space, but instead directly extend the file system across the disk.

Second, commonly used terminology

LVM is a logical layer that is added between the disk partition and the file system to mask the underlying disk partition layout for the file system, provide an abstract storage volume, and establish a file system on the storage volume. First, there are several terms for LVM:

  • Physical storage Media (Physicalstoragemedia): Refers to the physical storage device of the system: disk, such as:/dev/hda,/DEV/SDA, etc., is the storage system at the bottom of the storage unit.

  • Physical volume (physical VOLUME,PV): A disk partition or device that logically shares the same functionality as a disk partition (such as RAID), is the basic storage logic block of LVM, but is compared to basic physical storage media (such as partitions, disks, etc.) and contains management parameters related to LVM.

  • Volume group (Volume GROUP,VG): Similar to a physical disk in a non-LVM system, consisting of one or more physical volumes of PV. You can create one or more LV (logical volumes) on a volume group.

  • Logical Volume (Logical volume,lv): Similar to a disk partition in a non-LVM system, the logical volume is built on the volume group VG. File systems (such as/home or/usr, etc.) can be created on top of the logical volume LV.

  • Physical block (physical extent,pe): each physical volume PV is divided into a basic unit called PE (physical extents), with a uniquely numbered PE being the smallest unit that can be addressed by LVM. The size of the PE is configurable and defaults to 4MB. So the physical volume (PV) is made up of basic unit PE of equal size.

  • Logical Block (Logical extent,le): The logical volume LV is also classified as being able to be Addressing the basic unit, called Le. In the same volume group, the size of Le is the same as the PE, and one by one corresponds.

The diagram is as follows:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/DF/wKioL1djkNTTwOrrAABiCppMt0U097.jpg "title=" 8b13632762d0f70329d6d29f0bfa513d2697c509.jpg "alt=" Wkiol1djknttworraabicppmt0u097.jpg "/>


Iii. Creating and Managing LVM

The commands used in creating and managing LVM are not described in detail, for more information please use Baidu or Linux to bring your own help man.

1, confirm whether to install LVM, if not installed please use Yum install-y lvm2 installation

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/DF/wKioL1djkEzimlfeAAAImR32hrs988.png "title=" Capture 1. PNG "alt=" Wkiol1djkezimlfeaaaimr32hrs988.png "/>

2. View the hard disk and create a new partition (this installation uses/DEV/SDB demo):

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/82/E0/wKiom1djkAeSAztJAABLtQEdFNw027.png-wh_500x0-wm_3 -wmp_4-s_995698755.png "title=" Capture 2. PNG "alt=" Wkiom1djkaesaztjaabltqedfnw027.png-wh_50 "/>

Create 3 hard disk partitions by operation

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/82/E0/wKiom1djkqXy7l1HAAAaIaaTfqQ018.png-wh_500x0-wm_3 -wmp_4-s_2695911408.png "title=" Capture 3. PNG "alt=" Wkiom1djkqxy7l1haaaaiaatfqq018.png-wh_50 "/>

and save the changes with W

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/E0/wKioL1djlYaD84bRAAAMsWiV5kM770.png "title=" Capture 4. PNG "alt=" Wkiol1djlyad84braaamswiv5km770.png "/>

Use Fdisk-l/dev/sdb to view hard disk partitions

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/E1/wKiom1djlJCADtcIAAARVaJF5mo947.png "title=" Capture 5. PNG "alt=" Wkiom1djljcadtciaaarvajf5mo947.png "/>

3. Initialize the physical volume to PV volume

Create PV, add File system to PV, use Pvcreate to create PV volume, PVs or Pvdisplay to view PV volume situation.

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/82/E1/wKiom1djlcjTqsWQAAAosNtd2d4130.png-wh_500x0-wm_3 -wmp_4-s_1786470646.png "title=" Capture 6. PNG "alt=" Wkiom1djlcjtqswqaaaosntd2d4130.png-wh_50 "/>

4. Create a volume group VG

Add PV to the volume group to create the VG volume group.

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/82/E1/wKiom1djlwOR379ZAAAZMW2GGTw902.png-wh_500x0-wm_3 -wmp_4-s_3054151570.png "title=" Capture 7. PNG "alt=" Wkiom1djlwor379zaaazmw2ggtw902.png-wh_50 "/>

5. Create an LV logical volume

Create an LV logical volume on the VG volume group. Where:-L: Specifies the size of the LV-N: Specifies the name of the LV. VG0: Represents the division of LV from this VG.

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/82/E1/wKiom1djmPqj3Gv3AAAsL53LMN0173.png-wh_500x0-wm_3 -wmp_4-s_1348916868.png "title=" Capture 8. PNG "alt=" Wkiom1djmpqj3gv3aaasl53lmn0173.png-wh_50 "/>

6. Format the LV logical volume

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/82/E0/wKioL1djmp_g_NPRAAAg95bqr_4805.png-wh_500x0-wm_3 -wmp_4-s_2167784439.png "title=" Capture 9. PNG "alt=" Wkiol1djmp_g_npraaag95bqr_4805.png-wh_50 "/>

7. Hanging on LV Logical volume

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/82/E0/wKioL1djm9yhggg_AAAszhhOQMc666.png-wh_500x0-wm_3 -wmp_4-s_3847585127.png "title=" capture 10. PNG "alt=" Wkiol1djm9yhggg_aaaszhhoqmc666.png-wh_50 "/>

8. To be effective permanently, add the following in the last line of/etc/fstab

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/E0/wKioL1djnNKjjMFqAABCkDLfM_A500.png-wh_500x0-wm_3 -wmp_4-s_1054167515.png "title=" Capture 11. PNG "alt=" Wkiol1djnnkjjmfqaabckdlfm_a500.png-wh_50 "/>

At this point LVM creation and mounting is complete.


This article is from the "Frank" blog, so be sure to keep this source http://zhoufan.blog.51cto.com/4278592/1790308

Configuring LVM under Linux

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.