LVM Use Cases

Source: Internet
Author: User

LVM is the short name of Logical volume management (Logical Volume Manager), which is an abstraction layer built on top of a physical storage device that allows you to generate logical storage volumes, providing greater flexibility than managing direct use of physical storage.

LVM By storing virtualization, using logical volumes, you are not limited to the size of the physical disks, and the hardware-related storage settings are hidden, you can adjust the volume size or data migration without stopping the application or uninstalling the file system. This reduces operating costs.

LVM compared to using physical storage directly, you have the following advantages:

1. flexible capacity.

When using logical volumes, the file system can be extended to multiple disks, and you can aggregate multiple disks or partitions into a single logical volume.

2. a scalable storage pool.

You can use simple commands to enlarge or reduce the size of the logical volume without reformatting or partitioning the disk device.

3. Online redistribution of data .

You can move data online, and the data can be reassigned on-disk. For example, you can replace hot-swappable disks online.

4. Convenient naming of equipment

A logical volume can be any name that you feel is convenient.

5. disk is striped.

You can generate a logical disk whose data can be stored on 2 or more disks. This can significantly improve data throughput.

6. Mirrored volumes

Logical volumes provide a convenient way to mirror your data.

7. Volume Snapshots

With logical volumes, you can get device snapshots for consistent backups or test data updates without impacting real data.


Brief introduction:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3A/wKioL1Xe43rQWMgzAAEFJsgRi68751.jpg "title=" 92.png "alt=" Wkiol1xe43rqwmgzaaefjsgri68751.jpg "/>

Basic concepts:

PV (physical volume): We divide the partitions on the physical disk into LVM but other partitions

VG (Volume group): We pieced together these PV to form a space pool

LV (Logical volume): In the VG this space pool, we arbitrarily partition space, get the LVM sense partition we want, create file system on it

PE (physical extent) is the smallest storage unit in the LVM sense


Before you perform an operation on LVM, you need to make the System-id of the prestaged disk partition 8e to support LVM.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3F/wKiom1Xe6_njbnLeAADoQEJl9Ac635.jpg "title=" 97.png "alt=" Wkiom1xe6_njbnleaadoqejl9ac635.jpg "/>

PV Related commands:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3C/wKiom1Xez6Pgjx36AAA5kcZofAU639.jpg "style=" float: none; "title=" 70.png "alt=" Wkiom1xez6pgjx36aaa5kczofau639.jpg "/>

VG Related commands:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/39/wKioL1Xe0bzR-seFAAB1lRVPDKw056.jpg "style=" float: none; "title=" 71.png "alt=" Wkiol1xe0bzr-sefaab1lrvpdkw056.jpg "/>

LV Related commands:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3C/wKiom1Xez6PxzfXFAABjETwLZOw558.jpg "style=" float: none; "title=" 72.png "alt=" Wkiom1xez6pxzfxfaabjetwlzow558.jpg "/>

① creating the LVM process:

1. Create a PV (physical volume) and view PV information

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/39/wKioL1Xe1FeRzJA8AAFDAwWsW5I253.jpg "title=" 73.png "alt=" Wkiol1xe1ferzja8aafdawwsw5i253.jpg "/>

2. Create the VG, essentially splicing the PV (physical volume) into a VG (volume group), and view the VG information

Create the VG and view:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/39/wKioL1Xe10mT_E5yAAB3BDCLXqA156.jpg "style=" float: none; "title=" 76.png "alt=" Wkiol1xe10mt_e5yaab3bdclxqa156.jpg "/>


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/39/wKioL1Xe10mBCR9kAADY9Y1kzy0526.jpg "style=" float: none; "title=" 77.png "alt=" Wkiol1xe10mbcr9kaady9y1kzy0526.jpg "/>

Perform expansion and delete PV operations on existing VG (reduce VG):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/39/wKioL1Xe1p_iP1azAAByLAYSX9g741.jpg "style=" float: none; "title=" 74.png "alt=" Wkiol1xe1p_ip1azaabylaysx9g741.jpg "/>

* To perform this step, note that the data on the PV to be removed must first be moved to the remaining PV on the current VG, and make sure that there is enough space to confirm the error and then reduce the VG

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/39/wKioL1Xe2LCB5pENAAAmrfSCG4Q718.jpg "title=" 79.png "alt=" Wkiol1xe2lcb5penaaamrfscg4q718.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3D/wKiom1Xe1IbTqSddAAB1VeX_cJ4490.jpg "style=" float: none; "title=" 75.png "alt=" Wkiom1xe1ibtqsddaab1vex_cj4490.jpg "/>

Once the PV has been removed from the VG, the PV can be removed:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/39/wKioL1Xe2d-yV11kAAA_2uq9YVo085.jpg "title=" 80.png "alt=" Wkiol1xe2d-yv11kaaa_2uq9yvo085.jpg "/>

With the VG, it is found that the PE size of PV also determines the

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3D/wKiom1Xe1iyh9BVLAACbx5ayrvw291.jpg "title=" 78.png "alt=" Wkiom1xe1iyh9bvlaacbx5ayrvw291.jpg "/>

3.LV management----Divide the VG (volume group) into individual LV (logical volumes)

Create, view LV

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3A/wKioL1Xe3CnxIENpAACR8iV-AxE286.jpg "title=" 81.png "alt=" Wkiol1xe3cnxienpaacr8iv-axe286.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3D/wKiom1Xe2muQhjm5AADxYUFQM6w979.jpg "title=" 82.png "alt=" Wkiom1xe2muqhjm5aadxyufqm6w979.jpg "/>

Format our LV (logical volume):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3D/wKiom1Xe2tzw5ST6AAGXjvAAtTY833.jpg "title=" 83.png "alt=" Wkiom1xe2tzw5st6aagxjvaatty833.jpg "/>

Mount LV (logical volume):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3D/wKiom1Xe21CjhY_pAACLPxow-Nc006.jpg "title=" 84.png "alt=" Wkiom1xe21cjhy_paaclpxow-nc006.jpg "/>

*⑴ Extended LV (logical volume) to 2G:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/3D/wKiom1Xe3CiAtssBAABzUnqHcC0600.jpg "title=" 85.png "alt=" Wkiom1xe3ciatssbaabzunqhcc0600.jpg "/>

After the extension is complete, the/backup directory is found to be 1G, and does not increase with

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3E/wKiom1Xe3JXCJKwMAABNcHe0liw537.jpg "title=" 86.png "alt=" Wkiom1xe3jxcjkwmaabnche0liw537.jpg "/>

You need to use RESIZE2FS to modify the file system boundaries: After execution, it's expanded to 2G.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3E/wKiom1Xe3V6yT-dWAADj3JlNl0k220.jpg "title=" 87.png "alt=" Wkiom1xe3v6yt-dwaadj3jlnl0k220.jpg "/>

*⑵ Reducing logical volumes: need to follow a fixed process, otherwise risk

1. Uninstalling the file system

2. Forced file System repair

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3A/wKioL1Xe4RvzbjUsAACtrYhCdq0186.jpg "title=" 88.png "alt=" Wkiol1xe4rvzbjusaactryhcdq0186.jpg "/>

3. Using RESIZE2FS to reduce logical boundaries (file system boundaries), this step should be determined that the size of the reduced space should be sufficient to accommodate the previous data

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3E/wKiom1Xe30GR2_WAAAB5tU3QEeo893.jpg "title=" 89.png "alt=" Wkiom1xe30gr2_waaab5tu3qeeo893.jpg "/>

4. Reduce the logical volume with lvreduce

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/3A/wKioL1Xe4Zyyj7S-AAC6oxU1lA0934.jpg "title=" 90.png "alt=" Wkiol1xe4zyyj7s-aac6oxu1la0934.jpg "/>

5. Re-mount, view space, see if the file is missing

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3E/wKiom1Xe382wR9BKAADRGMdQmF0548.jpg "title=" 91.png "alt=" Wkiom1xe382wr9bkaadrgmdqmf0548.jpg "/>


Snapshot Features:

Rationale: Create a snapshot volume that tracks file changes on the original volume, copies the changed files to itself for future recovery, so that the snapshot volume saves a lot of space compared to a full backup, and the snapshot volume is generally set to a read-only state

1. Create a Snapshot Volume:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3E/wKiom1Xe5ZugyBcvAABAgPON_xU613.jpg "title=" 93.png "alt=" Wkiom1xe5zugybcvaabagpon_xu613.jpg "/>

2. Mount the snapshot Volume:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3B/wKioL1Xe6BWAqzvVAABsVIFQNCE324.jpg "title=" 94.png "alt=" Wkiol1xe6bwaqzvvaabsvifqnce324.jpg "/>

Verify the snapshot volume, change the file in the original volume, and discover that the snapshot volume is unchanged and successful:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/3B/wKioL1Xe6NGxcY6eAACwdf-el9o827.jpg "title=" 95.png "alt=" Wkiol1xe6ngxcy6eaacwdf-el9o827.jpg "/>
To unmount a snapshot volume:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/3B/wKioL1Xe6SmxbGVUAABnQ9gXJOQ769.jpg "title=" 96.png "alt=" Wkiol1xe6smxbgvuaabnq9gxjoq769.jpg "/>





This article is from the "After Tomorrow" blog, please be sure to keep this source http://leeyan.blog.51cto.com/8379003/1689024

LVM Use cases

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.