The first thing about the principle of LVM and the creation here is not to do too much explanation.
1. LVM Principle Analysis
LVM maintains a metadata on each physical volume (PV) head, called the volume Group description domain (vgda,volume group Description area), and each VGDA contains information about the entire VG (Volume group). Includes the layout configuration for each VG, the PV number, the LV number, and each PE-to-le mapping relationship. The information for each PV header in the same VG is the same, which facilitates data recovery in the event of a failure.
LVM provides the LV layer for the upper file system, which hides the operational details. For file systems, the operation of the LV is no different from the original operation on Partition. When writing to the LV, LVM locates the corresponding LE, and writes the data to the corresponding PE through the PV Head mapping table.
The key to the implementation of LVM is to establish a mapping relationship between PE and LE, and different mapping rules determine different LVM storage models. LVM supports multiple PV stripe and mirror, which is similar to the implementation of soft raid.
LVM provides an abstraction layer to the upper file system, which hides the details of the operation, and for the file system, the operation of the LV is no different from the original operation on the partition (Partition). When writing to the LV, LVM locates the corresponding Le, and writes the data to the corresponding PE through the PV Head mapping table.
Recently the company bought a new server has installed the Linux system, but the root partition is too small, so feel the need to expand, because my disk has been partitioned, no free, feel the home/home directory 2.7T reduced, and then increase the size of the root partition.
--1, use Df-ht to view the current disk usage.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/5B/wKiom1UGpC-RCsRYAADyBR9u77c731.jpg "title=" 11.png "alt=" Wkiom1ugpc-rcsryaadybr9u77c731.jpg "/>
Vgdisplay, check it out.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/5B/wKiom1UGpJOgEp2oAAFsLayne2A033.jpg "title=" 13.png "alt=" Wkiom1ugpjogep2oaafslayne2a033.jpg "/>
Can see my volgroup on the free 1.74TB, direct expansion can
--2,lvextend-l +1t/dev/mapper/volgroup-lv_root"1TB expansion to the root partition"
--3,resize2fs-f/dev/mapper/volgroup-lv_root"re-identify file system"
--4, when you execute the DF-HT command again, you will see that the root partition has been successfully expanded.
RESIZE2FS for EXT2/EXT3/EXT4 file system. Man, please.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/5B/wKiom1UGpveBWG1UAAC-UPrbyss452.jpg "title=" 14.png "alt=" Wkiom1ugpvebwg1uaac-uprbyss452.jpg "/>
"Reduced LVM"
It takes about 4 steps to reduce LVM.
--1, uninstalling the file system (Umount)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/5B/wKiom1UGqGmAN8GlAAD-sm-leUg681.jpg "title=" 15.png "alt=" Wkiom1ugqgman8glaad-sm-leug681.jpg "/>
--2, checking the file system (E2FSCK/FSCK.EXT4)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/56/wKioL1UGqnryCvQnAABclWvDIsA190.jpg "title=" 16.png "alt=" Wkiol1ugqnrycvqnaabclwvdisa190.jpg "/>
--3, shrinking file system (RESIZE2FS)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/5B/wKiom1UGqW2xGHA4AABrAPV8Pek797.jpg "title=" 17.png "alt=" Wkiom1ugqw2xgha4aabrapv8pek797.jpg "/>
--4, reducing LV size (lvreduce)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5B/56/wKioL1UGqriRtRuTAABrAPV8Pek193.jpg "title=" 17.png "alt=" Wkiol1ugqrirtrutaabrapv8pek193.jpg "/>
--5, you can finally use the LVS command to see
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/56/wKioL1UGqqaTf1WrAADZ8rR8b84323.jpg "title=" 18.png "alt=" Wkiol1ugqqatf1wraadz8rr8b84323.jpg "/>
--6, re-mount the file system,
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/56/wKioL1UGq1_QQKNbAABsLzcjSiE493.jpg "title=" 19.png "alt=" Wkiol1ugq1_qqknbaabslzcjsie493.jpg "/>
For more information about LVM, Google can do it yourself.
This article is from the "Hello_world" blog, make sure to keep this source http://coward.blog.51cto.com/7599475/1621215
Management of LVM--expansion and reduction