Linux Learning Note--lvm2

Source: Internet
Author: User

LVM is shorthand for Logical Volume Manager (Logical Volume management), which is implemented by Heinz Mauelshagen on the Linux 2.4 kernel. LVM sets the partition of one or more hard disks logically, equivalent to a large hard disk to use, when the hard disk space is not enough to use, you can continue to add the partitions of other hard disks, so that the dynamic management of disk space, relative to the normal disk partition has a lot of flexibility.

Create and manage LVM

Creating an LVM system generally requires a step

1. Create a partition

Linux has a very useful partition tool Fdisk, the specific partitioning process does not explain here, note to modify the disk ID 8e, after the creation

650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/72/66/wkiom1xip5sdjwamaabzevof8sk025.jpg "width=" 262 "height=" "/>"

2. Create PV

Pvcreate/dev/device

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "http://s3.51cto.com/wyfs02/M02/72/66/wKiom1Xip5TR51PXAAByVTUWnSc238.jpg" width= "244" height= "109"/ >

3. Create VG

vgcreate [-S #[kkmmggttppee]] volumegroupname physicaldevicepath [Physicaldevicepath ...

-S: Indicates the PE size

VG Expansion

Vgextend volumegroupname Physicaldevicepath [Physicaldevicepath ...]

VG Reduction

Vgreduce volumegroupname Physicaldevicepath [Physicaldevicepath ...]

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "http://s3.51cto.com/wyfs02/M00/72/66/wKiom1Xip5Th_HKAAABRCpBcNbY317.jpg" width= "244" height= "69"/ >

4. Create LV

Lvcreate-l #[mmggtt]-n NAME volumegroup

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "http://s3.51cto.com/wyfs02/M01/72/63/wKioL1XiqbGhlYfaAAAtzXwrlOo782.jpg" width= "244" height= "59"/ >

5. Format and Mount LV

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "http://s3.51cto.com/wyfs02/M01/72/66/wKiom1Xip5WAb7ZPAACTe9D6oEo243.jpg" width= "244" height= "172"/ >

When the format is complete, it can be mounted to the specified directory using the Mount command, and if you want to mount it automatically, you need to edit the/etc/fstab configuration file

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "http://s3.51cto.com/wyfs02/M02/72/63/wKioL1XiqbLyFtrNAACMPC3ybYM500.jpg" width= "244" height= "124"/ >

Expansion and reduction of LVM

1. Expanding the logical volume

lvextend-l [+]#[MMGGTT]/dev/vg_name/lv_name

Resize the logical volume, you need to adjust the size of the file system

Resize2fs/dev/vg_name/lv_name

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" image "border=" 0 "alt = "image" src= "http://s3.51cto.com/wyfs02/M00/72/63/wKioL1XiqbLDM0FzAABTTO-t-Jg374.jpg" width= "244" height= "109"/ >

2. Reduce the logical volume

Umount/dev/vg_name/lv_name

Unmount the logical volume first

E2fsck-f/dev/vg_name/lv_name

To force a test

Resize2fs/dev/vg_name/lv_name #[mmggtt]

First reduce the size of the file decency

lvreduce-l [-]#[MMGGTT]/dev/vg_name/lv_name

Then reduce the size of the logical volume

Mount

When the operation is complete, re-mount

Linux Learning Note--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.