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.
LVM provides a higher level of disk storage for computers than traditional disks and partitions. It makes it easier for system administrators to allocate storage space for apps and users. Storage volumes under LVM management can change size and remove as needed. LVM also allows storage volumes to be managed by user group, allowing administrators to use more intuitive names instead of physical disk names (such as ' SDA ', ' SDB ') to identify storage volumes
Physical volume (physical volume): a physical volume refers to a hard disk partition or a device (such as RAID) that logically has the same function as a disk partition, which 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): LVM volume groups are similar to physical hard disks in non-LVM systems, which consist of physical volumes. You can create one or more LVM partitions (logical volumes) on a volume group, and an LVM volume group consists of one or more physical volumes.
Logical volumes (logical volume): LVM logical volumes are similar to hard disk partitions in non-LVM systems, and file systems (such as/home or/usr) can be created on top of logical volumes.
PE (physical extent): each physical volume 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.
Le (logical extent): Logical volumes are also divided into addressable basic units called LE (logical extents). In the same volume group, the size of Le is the same as the PE, and one by one corresponds.
In simple terms:
PV: is a physical partition of the disk
The physical disk partition in VG:LVM, which is PV, must be added to the VG, which can be understood as a warehouse or a few large hard disks.
LV: The logical partition from the VG
Create LVM
First create PV
Pvcreate Creating PV
PVS View brief information
Pvdisplay View more information
650) this.width=650, "title=" qapqw]q1@}p9tabc0@ $NSF 6.png "src=" http://s3.51cto.com/wyfs02/M00/72/A6/ Wkiol1xqqatdxntwaac6bdpk3sa673.jpg "alt=" Wkiol1xqqatdxntwaac6bdpk3sa673.jpg "/>
650) this.width=650; "title=" Image 1.png "src=" http://s3.51cto.com/wyfs02/M02/72/AA/ Wkiom1xqpmrrw7ggaaduajct8yi963.jpg "alt=" Wkiom1xqpmrrw7ggaaduajct8yi963.jpg "/>
After creating the VG and the PV command using the same method
Vgcreate to indicate the volume label when it is created
VGS View VG Brief information,
PE default size is 4M, change size use vgcreate-s option to indicate size
650) this.width=650; "title=" Image 3.png "src=" http://s3.51cto.com/wyfs02/M00/72/AA/ Wkiom1xqqlvdlglyaacajj1suq8422.jpg "alt=" Wkiom1xqqlvdlglyaacajj1suq8422.jpg "/>
Expansion of the VG to first extend the PV, in the use of vgextend to extend the PV into the VG can
650) this.width=650; "title=" Image 4.png "src=" http://s3.51cto.com/wyfs02/M01/72/AA/ Wkiom1xqqdtc6e3caaceafxv4-0220.jpg "alt=" Wkiom1xqqdtc6e3caaceafxv4-0220.jpg "/>
If you want to move the PV, use Pvmove to move the PV data to the unused PV
650) this.width=650; "title=" Image 5.png "src=" http://s3.51cto.com/wyfs02/M01/72/A6/wKioL1XqrK3zaXSFAAA2_ Aiioyw066.jpg "alt=" Wkiol1xqrk3zaxsfaaa2_aiioyw066.jpg "/>
Vgreduce to remove PV
650) this.width=650; "title=" Image 6.png "src=" http://s3.51cto.com/wyfs02/M01/72/A6/ Wkiol1xqrumbef1waabrv7o6hjg770.jpg "alt=" Wkiol1xqrumbef1waabrv7o6hjg770.jpg "/>
Finally create the LV
lvcreate-l indicate size-n name Volume label name
In the indicated with that VG create LV
650) this.width=650; "title=" Image 7.png "src=" http://s3.51cto.com/wyfs02/M00/72/AA/wKiom1XqsBTyBOqgAABDvs_7024907. JPG "alt=" wkiom1xqsbtyboqgaabdvs_7024907.jpg "/>
After LVM creation is complete, format mounts are used
650) this.width=650; "title=" Image 9.png "src=" http://s3.51cto.com/wyfs02/M02/72/A6/ Wkiol1xqtf-svdcnaaeaukcdbsm568.jpg "alt=" Wkiol1xqtf-svdcnaaeaukcdbsm568.jpg "/>
650) this.width=650; "title=" Image 10.png "src=" Http://s3.51cto.com/wyfs02/M00/72/AA/wKiom1XqtCvgVt_ Maaa4kplnb2s352.jpg "alt=" Wkiom1xqtcvgvt_maaa4kplnb2s352.jpg "/>
If you extend a logical volume
The first step is to extend the physical boundary, in the extended file logical edit
The Lvextend-l (+) + sign indicates an increase on the original basis
No + number indicates an increase to
650) this.width=650; "title=" Image 8.png "src=" http://s3.51cto.com/wyfs02/M02/72/A6/ Wkiol1xqtnfhntdsaagc5ophies480.jpg "alt=" Wkiol1xqtnfhntdsaagc5ophies480.jpg "/>
650) this.width=650; "title=" Image 11.png "src=" http://s3.51cto.com/wyfs02/M00/72/A7/ Wkiol1xqtvlhtds4aaeonbv0pq8328.jpg "alt=" Wkiol1xqtvlhtds4aaeonbv0pq8328.jpg "/>
To shrink a logical volume, reduce the logical boundary first, and then reduce the physical boundary,
1. Uninstalling the file system
2. Mandatory detection of file systems
3. Reducing logical boundaries
4. Reducing physical boundaries
Lvreduce
650) this.width=650; "title=" Image 12.png "src=" http://s3.51cto.com/wyfs02/M01/72/A7/ Wkiol1xqul3suie4aamsikvaeck462.jpg "alt=" Wkiol1xqul3suie4aamsikvaeck462.jpg "/>
The step is a little rough, the technique is limited, we can deal with it
Basic application of LVM