The previous chapter we said that the partition of the hard disk, format and mount partition, use can be normal use, but once the system partition is not enough, we have to back up, delete the relevant data or re-planning partition to meet the needs of the system, then how to solve this kind of problem? This allows for the use of LVM dynamic partitioning, referred to in our headline, to improve disk management flexibility by dynamically adjusting disk capacity as existing data does not change.
Before we perform LVM logical volume management, we need to understand some basic terminology of LVM:
PV (physical Volume, physical volumes) physical volumes are basic storage devices for the LVM mechanism, usually corresponding to a normal partition or an entire hard disk. When a physical volume is created, a reserved partition is created on the head of the partition or hard disk, used to record the properties of the LVM and splits the storage space into a default unit (physical Extent,pe) with a default size of 4MB, and it is important to note that the ID tag of the partition type should be changed to 8e before the physical volume is converted.
in order to better demonstrate today's experiment, I added two hard drives here , by the way to review the disk partition, using the Fdisk tool to partition, the partition system file type to "8e", the two hard disk partitions are divided well
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/79/7F/wKiom1aTCiuj6YlZAADekiV0Bjk700.jpg "title=" 1.jpg " alt= "Wkiom1atciuj6ylzaadekiv0bjk700.jpg"/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/79/7F/wKiom1aTCvaQselIAAEIkAq1rNQ735.jpg "title=" 2.jpg " alt= "Wkiom1atcvaqseliaaeikaq1rnq735.jpg"/>
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/79/80/wKiom1aTEZXhJKG4AAEGp4-W0TI830.jpg "title=" 3.jpg " alt= "Wkiom1atezxhjkg4aaegp4-w0ti830.jpg"/>
I. PV physical Volume management
1.pvcreate Command : Used to convert a partition or an entire hard disk into a physical volume
Example of converting/DEV/SDB1 and/DEV/SDC1 to physical volumes
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/79/7F/wKioL1aTEgbhOUw9AABHSxX-f2U669.jpg "title=" 4.jpg " alt= "Wkiol1ategbhouw9aabhsxx-f2u669.jpg"/>
2.pvscan Command: used to scan all physical volumes in the system
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/79/80/wKioL1aTJXHD-2FAAABQiqgbqck143.jpg "title=" Scan physical volumes. jpg "alt=" wkiol1atjxhd-2faaabqiqgbqck143.jpg "/>
3.pvdisplay Command: Show details of physical volumes
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/79/82/wKiom1aTJaPwrBMGAABvFpFZvYA969.jpg "title=" Displays physical volume information. jpg "alt=" wkiom1atjapwrbmgaabvfpfzvya969.jpg "/>
4.pvremove Command: Restore physical volumes to normal partitions
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/79/81/wKioL1aTJnriVZdxAABsoSv-Aiw547.jpg "title=" Remove the physical volume. jpg "alt=" wkiol1atjnrivzdxaabsosv-aiw547.jpg "/>
Description: After removal, we can not scan the/DEV/SDB1 partition with Pvscan.
Two. VG Volume Group Management
1.vgcreate Command: Create a volume group (the name of the volume group is custom, here we name the volume group as Mail)
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/79/80/wKiom1aTEzyQwjqCAAA0IXKkpEU110.jpg "title=" 5.jpg " alt= "Wkiom1atezyqwjqcaaa0ixkkpeu110.jpg"/>
2.vgscan command: used to scan LVG volume groups already established in the system
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/81/wKioL1aTLEqivUnbAABIjgNCNkU203.jpg "title=" Scan volume group. jpg "alt=" wkiol1atleqivunbaabijgncnku203.jpg "/>
3.vgdisplay Command: display detailed information for each volume group in the system
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/79/82/wKiom1aTNW_ANUMxAACHnHTiEho741.jpg "title=" Displays volume group information. jpg "alt=" wkiom1atnw_anumxaachnhtieho741.jpg "/>
4.vgremove Command: delete the specified volume group
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/82/wKiom1aTNi_SHbLSAABTtNMOkJs830.jpg "title=" Remove the volume group. jpg "alt=" wkiom1atni_shblsaabttnmokjs830.jpg "/>
5.vgextend Command: disk space used to extend the volume group
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/83/wKiom1aTPjWBvsbzAABZzHB9bgo281.jpg "title=" Extended volume group space. jpg "alt=" wkiom1atpjwbvsbzaabzzhb9bgo281.jpg "/>
6.vgreduce Command: to reduce disk space for a volume group
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/81/wKioL1aTPo3gslEWAAAkb4OYEZo804.jpg "title=" Reduce volume group space. jpg "alt=" wkiol1atpo3gslewaaakb4oyezo804.jpg "/>
Three. LV Logical Volume Management
1.lvcreate Command:lvcreate-l capacity Size-N Logical Volume name volume group name Create logical Volume
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/79/7F/wKioL1aTFzzShXeiAAA2gi88NMs915.jpg "title=" 6.jpg " alt= "Wkiol1atfzzshxeiaaa2gi88nms915.jpg"/>
In this way, the logical volume is created, and it is formatted and mounted so that it can be used normally.
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/79/81/wKiom1aTHQiB76nwAAB-33TuIkE331.jpg "title=" 8.jpg " alt= "Wkiom1athqib76nwaab-33tuike331.jpg"/>
2.lvscan Command: scanning the established logical volumes in the system and their related information
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/81/wKioL1aTQH3zimIJAABSxDFO4Po919.jpg "title=" Displays logical volume information. jpg "alt=" wkiol1atqh3zimijaabsxdfo4po919.jpg "/>
3.lvdisplay Command: displaying the details of a logical volume
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/79/83/wKiom1aTQUej-IjIAACJpSF_TRw930.jpg "title=" Displays logical volume information. jpg "alt=" wkiom1atquej-ijiaacjpsf_trw930.jpg "/>
4.lvextend Command:lvextend-l + size/dev/Volume group name/logical volume name for dynamic expansion of logical volume space
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/81/wKioL1aTSVGzOW2_AAFPxEWZl7s702.jpg "title=" Extended logical volume space. jpg "alt=" wkiol1atsvgzow2_aafpxewzl7s702.jpg "/>
Note: If the lvextend-l is directly followed by a numeric value, there is no plus "+", then the representative will specify that the logical volume is extended to such a large amount of space, does not mean the increase in space, as shown in
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/82/wKioL1aTTPiRgVEkAAEWHvONSAY188.jpg "title=" Extended Logical Volume space 2.jpg "alt=" Wkiol1attpirgvekaaewhvonsay188.jpg "/>
5.lvreduce Command :lvreduce-l-size/dev/Volume group name/logical volume name for reduced logical volume space
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/79/82/wKioL1aTTczTIySqAACSYKCk-Ac868.jpg "title=" Reduce logical volume space. jpg "alt=" wkiol1attcztiysqaacsykck-ac868.jpg "/>
Description: The Lvreduce command, like the Lvextend command, does not have a minus "-" when the size of the space is reduced, which represents the amount of space to adjust the logical volume to the specified value
6.lvremove Command: To delete a specified logical volume
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/79/83/wKiom1aTT0DDmkmxAACV990n164687.jpg "title=" Delete the logical volume. jpg "alt=" wkiom1att0ddmkmxaacv990n164687.jpg "/>
Okay, LVG. The basic operation of Disk Management is written here, the next chapter will use the case to explain the actual application of the LVG volume and how disk quotas are set
Linux server disk and file system Management (ii) Basic operations of LVM logical volume management