The management of LVM
Let's first introduce the DM, and the rationale of the logical Volume:
Dm:device Mapper Device Mapping, a mechanism for providing logical devices
1, the combination of multiple physical devices into a logical device
2, the implementation of RAID,LVM2 (logical Volume 2) function
3, the core of LVM2 function realization
4, to achieve dynamic expansion and reduce the file system space
5, supporting the function of mirroring
DM How to organize multiple physical devices into logical devices:
Linear (linear devices), mirror (similar to mirrors), snapshot (snapshots), multipath (multipath)
Snapshot: Access another path to the same data. Implementing Data Backup
Multiple physical disks in a DM are organized into a logical device that requires the creation of similar logical partitions to be used on logical devices.
Physical volume pv:physical Volume (that is, multiple physical devices)
Volume Group Vg:volume Group (logical device, PV combination)
Logical volumes: Logical Volume (dynamically extended partitions)
Each logical volume is a separate file system that has two boundaries: physical boundaries, logical boundaries
Snapshots can be created on logical volumes, and logical volumes and snapshots are stored in VG.
The volume group is composed of a PE, and PE transition to logical volume, is called VE
Pe:physial Extend, Physical disk area. Physical volumes can only become PE when they are joined to a volume group
Le:logical Extend, Logical Disk area
Next, let's talk about the management of logical volumes:
It is recommended that you create logical volumes on RAID. (Hardware RAID)
Pv
Pvcreate: Create PV.
-F: Force create
Example: # pvcreate/dev/sda{10,11}
Pvscan | PVS: Scans the current system a total number of PV
Pvdisplay: View PV Details, you can specify a PV
Example: # PVDISPLAY/DEV/SDA10
Pvmove: Move data from the disk in which the data is stored to another disk area
Example: # PVMOVE/DEV/SDA10
Pvremove: Erase the source data from a panel
Example: # pvremove/dev/sda10 (delete/dev/sda10 panel)
Preparing to create PV requires a few disks and a disk type of 8e, which is the LVM type.
Vg:
Vgcreate: Creating VG
-S #: Specify PE size, default to 4M
Example: # Vgcreate myvg/dev/sda{10,11}
Vgremove: Remove VG
Example: # Vgremove MYVG
Vgextend: Extend the size of the VG, that is, add a PE
Example: # Vgextend Myvg/dev/sda12
Vgreduce: Reduce the size of the VG, that is, the process of removing a PE
Example: # Vgreduce MYVG/DEV/SDA10
VGS: See how many volume groups are on the current system
Vgdisplay: View the details of the VG to specify a VG
Lv:
Lvcreate: Creating LV
-N: Specify name
-L: Specify size
Lvcreate-n lv_name-l #G Vg_name
Example: # lvcreat-l 50m-n TESTLV MYVG
Lvremove: Remove LV
Example: # LVREMOVE/DEV/MYVG/TESTLV